Browse Source

修复色彩迷阵的方块

夏可文 6 years ago
parent
commit
3535e7bd92

+ 23 - 0
data/mini/functions/colormatch/game/show_floor_block.mcfunction

@@ -0,0 +1,23 @@
+# 清理物品
+clear @s acacia_planks{game_item:1b}
+clear @s birch_planks{game_item:1b}
+clear @s bedrock{game_item:1b}
+clear @s crimson_planks{game_item:1b}
+clear @s warped_planks{game_item:1b}
+clear @s gold_block{game_item:1b}
+clear @s bricks{game_item:1b}
+clear @s mossy_cobblestone{game_item:1b}
+clear @s purpur_block{game_item:1b}
+clear @s prismarine{game_item:1b}
+
+# 物品栏显示
+execute if score $color_match_floor mem matches 1 run replaceitem entity @s hotbar.8 acacia_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 2 run replaceitem entity @s hotbar.8 birch_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 3 run replaceitem entity @s hotbar.8 bedrock{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 4 run replaceitem entity @s hotbar.8 crimson_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 5 run replaceitem entity @s hotbar.8 warped_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 6 run replaceitem entity @s hotbar.8 gold_block{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 7 run replaceitem entity @s hotbar.8 bricks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 8 run replaceitem entity @s hotbar.8 mossy_cobblestone{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 9 run replaceitem entity @s hotbar.8 purpur_block{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
+execute if score $color_match_floor mem matches 10 run replaceitem entity @s hotbar.8 prismarine{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}

+ 2 - 22
data/mini/functions/colormatch/game/start_new_round.mcfunction

@@ -29,25 +29,5 @@ bossbar set mini:red name "地板消失"
 # 给予进度
 execute if score $countdown_max mem matches 10 as @a[tag=!debug,gamemode=adventure] run advancement grant @s only ltw:parkour/colormatch1
 
-# 物品栏显示
-execute if score $color_match_floor mem matches 1 run replaceitem entity @a hotbar.8 acacia_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 2 run replaceitem entity @a hotbar.8 birch_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 3 run replaceitem entity @a hotbar.8 bedrock{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 4 run replaceitem entity @a hotbar.8 crimson_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 5 run replaceitem entity @a hotbar.8 warped_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 6 run replaceitem entity @a hotbar.8 gold_block{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 7 run replaceitem entity @a hotbar.8 bricks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 8 run replaceitem entity @a hotbar.8 mossy_cobblestone{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 9 run replaceitem entity @a hotbar.8 purpur_block{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-execute if score $color_match_floor mem matches 10 run replaceitem entity @a hotbar.8 prismarine{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
-
-# execute if score $color_match_floor mem matches 1 run replaceitem entity @a hotbar.8 acacia_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.acacia_planks","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 2 run replaceitem entity @a hotbar.8 birch_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.birch_planks","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 3 run replaceitem entity @a hotbar.8 bedrock{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.bedrock","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 4 run replaceitem entity @a hotbar.8 crimson_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.crimson_planks","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 5 run replaceitem entity @a hotbar.8 warped_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.warped_planks","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 6 run replaceitem entity @a hotbar.8 gold_block{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.gold_block","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 7 run replaceitem entity @a hotbar.8 bricks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.bricks","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 8 run replaceitem entity @a hotbar.8 mossy_cobblestone{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.mossy_cobblestone","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 9 run replaceitem entity @a hotbar.8 purpur_block{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.purpur_block","bold":true,"color":"gold"}]'}}
-# execute if score $color_match_floor mem matches 10 run replaceitem entity @a hotbar.8 prismarine{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false},{"translate": "block.minecraft.prismarine","bold":true,"color":"gold"}]'}}
+# 更新地板方块
+execute as @a run function mini:colormatch/game/show_floor_block

+ 3 - 4
data/mini/functions/colormatch/tick2.mcfunction

@@ -3,10 +3,9 @@
 execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ magma_block run function mini:colormatch/player_lose_heart
 execute as @a[tag=mini_running] at @s if block ~ ~-2 ~ magma_block run function mini:colormatch/player_lose_heart
 
+# 检测玩家背包
+execute as @a[tag=mini_running] unless data entity @s Inventory[{Slot:8b,tag:{game_item:1b}}] if data entity @s Inventory[{tag:{game_item:1b}}] run function mini:colormatch/game/show_floor_block
+
 # 开始新的一轮
 execute if score $countdown_fast mem matches 0 if score $color_match_type mem matches 0 run function mini:colormatch/game/remove_ground
 execute if score $countdown_fast mem matches 0 if score $color_match_type mem matches 1 run function mini:colormatch/game/start_new_round
-
-# 显示当前剩余秒数
-# execute if score $countdown_fast mem matches 1.. if score $color_match_type mem matches 0 run title @a actionbar [{"text":"地板消失: ","color":"red","bold": true},{"score": { "name": "$countdown_fast","objective": "mem"}}]
-# execute if score $countdown_fast mem matches 1.. if score $color_match_type mem matches 1 run title @a actionbar [{"text":"下一轮: ","color":"green","bold": true},{"score": { "name": "$countdown_fast","objective": "mem"}}]

+ 1 - 1
data/mini/functions/phantom/player_failed.mcfunction

@@ -5,4 +5,4 @@ gamemode spectator
 tp @s[tag=!debug] 1062.34 27.11 6040.84 461.44 28.30
 tellraw @a ["",{"text": ">> ","color":"red","bold": true},{"selector": "@s","color":"red"}," 已死亡!"]
 execute as @a at @s run function lib:sounds/error
-execute unless entity @a[gamemode=adventure] run function mini:main/game_end
+execute unless entity @a[tag=mini_running] run function mini:main/game_end