LTCatt 6 tahun lalu
induk
melakukan
ca59f91107

+ 19 - 0
data/ltw/functions/state/6/generate_bonus.mcfunction

@@ -0,0 +1,19 @@
+# 生成奖励物品
+kill @e[type=item]
+
+execute store result score $t_player_count mem if entity @a[tag=!watcher]
+execute if score $t_player_count mem matches 1.. positioned 9.0 12.5 2012.5 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 2.. positioned 5.0 12.5 2012.5 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 3.. positioned 1.5 12.5 2009.0 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 4.. positioned 1.5 12.5 2005.0 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 5.. positioned 5.0 12.5 2001.5 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 6.. positioned 9.0 12.5 2001.5 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 7.. positioned 12.5 12.5 2005.0 run function item:bonus_item/rank/random
+execute if score $t_player_count mem matches 8.. positioned 12.5 12.5 2009.0 run function item:bonus_item/rank/random
+
+# 生成拾取窗口
+execute as @e[type=item] at @s run fill ~-0.2 ~ ~-0.2 ~0.2 ~ ~0.2 air
+execute as @e[type=item] at @s run fill ~-0.2 ~1 ~-0.2 ~0.2 ~1 ~0.2 barrier
+
+# 防止幽灵实体,分 tick 执行
+schedule function ltw:state/6/generate_bonus2 1t

+ 0 - 0
data/ltw/functions/state/6/state_enter2.mcfunction → data/ltw/functions/state/6/generate_bonus2.mcfunction


+ 2 - 19
data/ltw/functions/state/6/state_enter.mcfunction

@@ -12,27 +12,10 @@ scoreboard players set $countdown mem 10
 
 # 初始化地图
 forceload add 0 2000 50 2050
-kill @e[type=item]
 
 # 生成地图
 setblock 0 10 2000 minecraft:structure_block{mode:"LOAD",name:"ltw:select"}
 setblock 0 11 2000 minecraft:redstone_block
 
-# 生成奖励物品
-execute store result score $t_player_count mem if entity @a[tag=!watcher]
-# scoreboard players set $t_player_count mem 8
-execute if score $t_player_count mem matches 1.. positioned 9.0 12.5 2012.5 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 2.. positioned 5.0 12.5 2012.5 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 3.. positioned 1.5 12.5 2009.0 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 4.. positioned 1.5 12.5 2005.0 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 5.. positioned 5.0 12.5 2001.5 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 6.. positioned 9.0 12.5 2001.5 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 7.. positioned 12.5 12.5 2005.0 run function item:bonus_item/rank/random
-execute if score $t_player_count mem matches 8.. positioned 12.5 12.5 2009.0 run function item:bonus_item/rank/random
-
-# 生成拾取窗口
-execute as @e[type=item] at @s run fill ~-0.2 ~ ~-0.2 ~0.2 ~ ~0.2 air
-execute as @e[type=item] at @s run fill ~-0.2 ~1 ~-0.2 ~0.2 ~1 ~0.2 barrier
-
-# 防止幽灵实体,分 tick 执行
-schedule function ltw:state/7/state_enter2 1t
+# 让地图先加载好
+schedule function ltw:state/6/generate_bonus 1t

+ 1 - 0
data/test/functions/generate_bonus.mcfunction

@@ -1,6 +1,7 @@
 # 刷新奖励房间
 
 tag @a remove watcher
+scoreboard players set $game_type mem 1
 scoreboard players set $round mem 4
 function ltw:state/6/state_enter
 scoreboard players set $state mem 0