Просмотр исходного кода

增加color match计时以及旁观者范围限制

HerobrineXia 6 лет назад
Родитель
Сommit
9eadf20bde

+ 1 - 2
data/mini/functions/colormatch/game_init.mcfunction

@@ -1,6 +1,5 @@
 # 初始化地图
 forceload add 1001 4000 1075 4025
-
 fill 1049 10 4025 1075 10 3999 minecraft:bedrock
 fill 1074 11 4000 1050 11 4024 lava
 fill 1074 15 4000 1050 15 4024 stone
@@ -12,7 +11,7 @@ fill 1074 30 4024 1050 30 4000 barrier
 
 # 设置分数
 scoreboard players set $color_match_round mem 0
-scoreboard players set $color_match_time mem 15
+scoreboard players set $color_match_time mem 10
 
 # 设置模式为地板消失
 scoreboard players set $color_match_type mem 0

+ 26 - 26
data/mini/functions/colormatch/get_random_floor.mcfunction

@@ -4,32 +4,32 @@ function lib:random
 
 # TODO 更换地板方块-增强对比+辨识度
 # 随机选择不消失的方块
-execute positioned 1000 10 4000 run fill ~ ~1 ~ ~24 ~1 ~24 air replace
-execute positioned 1000 10 4000 if score $random mem matches 1 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered iron_block
-execute positioned 1000 10 4000 if score $random mem matches 2 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_concrete
-execute positioned 1000 10 4000 if score $random mem matches 3 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered quartz_block
-execute positioned 1000 10 4000 if score $random mem matches 4 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered snow_block
-execute positioned 1000 10 4000 if score $random mem matches 5 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_wool
-execute positioned 1000 10 4000 if score $random mem matches 6 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered gold_block
-execute positioned 1000 10 4000 if score $random mem matches 7 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sponge
-execute positioned 1000 10 4000 if score $random mem matches 8 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sandstone
-execute positioned 1000 10 4000 if score $random mem matches 9 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered yellow_concrete
-execute positioned 1000 10 4000 if score $random mem matches 10 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered end_stone
-execute positioned 1000 10 4000 if score $random mem matches 11 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered emerald_block
-execute positioned 1000 10 4000 if score $random mem matches 12 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered lime_concrete
-execute positioned 1000 10 4000 if score $random mem matches 13 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered melon
-execute positioned 1000 10 4000 if score $random mem matches 14 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered dark_prismarine
-execute positioned 1000 10 4000 if score $random mem matches 15 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered green_wool
-execute positioned 1000 10 4000 if score $random mem matches 16 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered diamond_block
-execute positioned 1000 10 4000 if score $random mem matches 17 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine
-execute positioned 1000 10 4000 if score $random mem matches 18 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered blue_ice
-execute positioned 1000 10 4000 if score $random mem matches 19 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered warped_wart_block
-execute positioned 1000 10 4000 if score $random mem matches 20 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine_bricks
-execute positioned 1000 10 4000 if score $random mem matches 21 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_wool
-execute positioned 1000 10 4000 if score $random mem matches 22 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_concrete
-execute positioned 1000 10 4000 if score $random mem matches 23 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered netherrack
-execute positioned 1000 10 4000 if score $random mem matches 24 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_nether_bricks
-execute positioned 1000 10 4000 if score $random mem matches 24 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered bricks
+execute positioned 1001 10 4000 run fill ~ ~1 ~ ~24 ~1 ~24 air replace
+execute positioned 1001 10 4000 if score $random mem matches 1 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered iron_block
+execute positioned 1001 10 4000 if score $random mem matches 2 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_concrete
+execute positioned 1001 10 4000 if score $random mem matches 3 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered quartz_block
+execute positioned 1001 10 4000 if score $random mem matches 4 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered snow_block
+execute positioned 1001 10 4000 if score $random mem matches 5 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_wool
+execute positioned 1001 10 4000 if score $random mem matches 6 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered gold_block
+execute positioned 1001 10 4000 if score $random mem matches 7 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sponge
+execute positioned 1001 10 4000 if score $random mem matches 8 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sandstone
+execute positioned 1001 10 4000 if score $random mem matches 9 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered yellow_concrete
+execute positioned 1001 10 4000 if score $random mem matches 10 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered end_stone
+execute positioned 1001 10 4000 if score $random mem matches 11 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered emerald_block
+execute positioned 1001 10 4000 if score $random mem matches 12 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered lime_concrete
+execute positioned 1001 10 4000 if score $random mem matches 13 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered melon
+execute positioned 1001 10 4000 if score $random mem matches 14 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered dark_prismarine
+execute positioned 1001 10 4000 if score $random mem matches 15 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered green_wool
+execute positioned 1001 10 4000 if score $random mem matches 16 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered diamond_block
+execute positioned 1001 10 4000 if score $random mem matches 17 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine
+execute positioned 1001 10 4000 if score $random mem matches 18 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered blue_ice
+execute positioned 1001 10 4000 if score $random mem matches 19 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered warped_wart_block
+execute positioned 1001 10 4000 if score $random mem matches 20 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine_bricks
+execute positioned 1001 10 4000 if score $random mem matches 21 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_wool
+execute positioned 1001 10 4000 if score $random mem matches 22 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_concrete
+execute positioned 1001 10 4000 if score $random mem matches 23 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered netherrack
+execute positioned 1001 10 4000 if score $random mem matches 24 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_nether_bricks
+execute positioned 1001 10 4000 if score $random mem matches 24 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered bricks
 
 # 存计分板
 scoreboard players operation $color_match_floor mem = $random mem

+ 26 - 26
data/mini/functions/colormatch/show_block_amount.mcfunction

@@ -3,59 +3,59 @@ scoreboard objectives add block_count dummy
 
 # 获取分数
 tellraw @a [{"text":"本轮方块列表:","color":"gold"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered iron_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered iron_block
 tellraw @a [{"text":"iron_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_concrete
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_concrete
 tellraw @a [{"text":"white_concrete数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered quartz_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered quartz_block
 tellraw @a [{"text":"quartz_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered snow_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered snow_block
 tellraw @a [{"text":"snow_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_wool
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered white_wool
 tellraw @a [{"text":"white_wool数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered gold_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered gold_block
 tellraw @a [{"text":"gold_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sponge
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sponge
 tellraw @a [{"text":"sponge数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sandstone
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered sandstone
 tellraw @a [{"text":"sandstone数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered yellow_concrete
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered yellow_concrete
 tellraw @a [{"text":"yellow_concrete数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered end_stone
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered end_stone
 tellraw @a [{"text":"end_stone数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered emerald_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered emerald_block
 tellraw @a [{"text":"emerald_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered lime_concrete
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered lime_concrete
 tellraw @a [{"text":"lime_concrete数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered melon
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered melon
 tellraw @a [{"text":"melon数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered dark_prismarine
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered dark_prismarine
 tellraw @a [{"text":"dark_prismarine数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered green_wool
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered green_wool
 tellraw @a [{"text":"green_wool数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered diamond_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered diamond_block
 tellraw @a [{"text":"diamond_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine
 tellraw @a [{"text":"prismarine数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered blue_ice
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered blue_ice
 tellraw @a [{"text":"blue_ice数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered warped_wart_block
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered warped_wart_block
 tellraw @a [{"text":"warped_wart_block数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine_bricks
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered prismarine_bricks
 tellraw @a [{"text":"prismarine_bricks数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_wool
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_wool
 tellraw @a [{"text":"red_wool数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_concrete
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_concrete
 tellraw @a [{"text":"red_concrete数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered netherrack
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered netherrack
 tellraw @a [{"text":"netherrack数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_nether_bricks
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered red_nether_bricks
 tellraw @a [{"text":"red_nether_bricks数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
-execute store result score block_count block_count positioned 1000 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered bricks
+execute store result score block_count block_count positioned 1001 10 4000 run clone ~ ~ ~ ~24 ~ ~24 ~ ~1 ~ filtered bricks
 tellraw @a [{"text":"bricks数量: ","color":"green"},{"score": {"objective": "block_count","name": "block_count"},"color":"white"}]
 
 # 删除方块
-execute positioned 1000 10 4000 run fill ~ ~1 ~ ~24 ~1 ~24 air replace
+execute positioned 1001 10 4000 run fill ~ ~1 ~ ~24 ~1 ~24 air replace
 
 # 删除计分板
 scoreboard objectives remove block_count

+ 3 - 1
data/mini/functions/colormatch/spectator_range.mcfunction

@@ -1 +1,3 @@
-# TODO 观察者限定范围
+# TODO 观察者限定范围
+execute as @a[gamemode=spectator,x=1049,y=10,z=4025,dx=27,dz=27,dy=30] run spectate
+tp @a[gamemode=spectator,x=1049,y=10,z=4025,dx=27,dz=27,dy=30] 1062 30 4012 0 180

+ 2 - 1
data/mini/functions/colormatch/tick20.mcfunction

@@ -3,4 +3,5 @@
 execute if score $countdown mem matches 0 if score $color_match_type mem matches 0 run function mini:colormatch/remove_ground
 execute if score $countdown mem matches 0 if score $color_match_type mem matches 1 run function mini:colormatch/start_new_round
 
-# TODO 显示当前剩余秒数
+# 显示当前剩余秒数
+execute if score $countdown mem matches 1.. run title @a actionbar [{"text":"剩余时间: ","color":"red","bold": true},{"score": { "name": "$countdown","objective": "mem"}}]