LTCatt 5 лет назад
Родитель
Сommit
7ed14de274

+ 1 - 7
data/ltw/functions/state/0/player_enter.mcfunction

@@ -23,10 +23,7 @@ recipe take @s *
 xp set @s 0 points
 xp set @s 0 levels
 
-# 物品
-clear @s
-
-# 设置默认状态
+# 设置默认状态(这也会刷新物品)
 function ltw:state/0/sp/join_watch
 
 
@@ -35,6 +32,3 @@ function ltw:state/0/sp/join_watch
 
 ## 开启触发器
 #scoreboard players enable @s buy_trigger
-
-#execute as @s run function item:shop/refresh_gold
-#execute as @s run function item:shop/refresh_green

+ 6 - 0
data/ltw/functions/state/0/sp/inventory/refresh.mcfunction

@@ -0,0 +1,6 @@
+clear @s
+kill @e[type=item,tag:{lobby_item:1b}}}]
+
+# 选择物品
+item entity @s[team=hub_play] hotbar.0 replace lime_wool{lobby_item:1b,display:{Name:'[{"text":"","color":"green","italic":false},"准备模式 (按 ",{"keybind":"key.drop"}," 以旁观)"]',Lore:['[{"text":"","color":"gray","italic":false},"你将在下一局参与游戏"]']}}
+item entity @s[team=hub_watch] hotbar.0 replace light_gray_wool{lobby_item:1b,display:{Name:'[{"text":"","color":"white","italic":false},"旁观模式 (按 ",{"keybind":"key.drop"}," 以准备)"]',Lore:['[{"text":"","color":"gray","italic":false},"你将在下一局旁观游戏"]']}}

+ 3 - 11
data/ltw/functions/state/0/sp/join_play.mcfunction

@@ -1,15 +1,7 @@
 
-# 清理现有选择物品
-clear @s lime_wool{lobby_item:1b}
-clear @s light_gray_wool{lobby_item:1b}
-kill @e[type=item,nbt={Item:{id:"minecraft:light_gray_wool",tag:{lobby_item:1b}}}]
-# 弹出玩家放在第一格上的物品
-execute if data entity @s Inventory[{Slot:0b}] run scoreboard players set @s temp 0
-execute if data entity @s Inventory[{Slot:0b}] at @s run function lib:pop_slot/return_item
-# 设置新的选择物品
-item entity @s hotbar.0 replace lime_wool{lobby_item:1b,display:{Name:'[{"text":"","color":"green","italic":false},"准备模式 (按 ",{"keybind":"key.drop"}," 以旁观)"]',Lore:['[{"text":"","color":"gray","italic":false},"你将在下一局参与游戏"]']}}
-
 # 设置队伍
 team join hub_play @s
 # 播放音效
-execute at @s run function lib:sounds/hit
+execute at @s run function lib:sounds/hit
+# 刷新物品
+function ltw:state/0/sp/inventory/refresh

+ 2 - 10
data/ltw/functions/state/0/sp/join_watch.mcfunction

@@ -1,15 +1,7 @@
 
-# 清理现有选择物品
-clear @s lime_wool{lobby_item:1b}
-clear @s light_gray_wool{lobby_item:1b}
-kill @e[type=item,nbt={Item:{id:"minecraft:lime_wool",tag:{lobby_item:1b}}}]
-# 弹出玩家放在第一格上的物品
-execute if data entity @s Inventory[{Slot:0b}] run scoreboard players set @s temp 0
-execute if data entity @s Inventory[{Slot:0b}] at @s run function lib:pop_slot/return_item
-# 设置新的选择物品
-item entity @s hotbar.0 replace light_gray_wool{lobby_item:1b,display:{Name:'[{"text":"","color":"white","italic":false},"旁观模式 (按 ",{"keybind":"key.drop"}," 以准备)"]',Lore:['[{"text":"","color":"gray","italic":false},"你将在下一局旁观游戏"]']}}
-
 # 设置队伍
 team join hub_watch @s
 # 播放音效
 execute at @s run function lib:sounds/hit2
+# 刷新物品
+function ltw:state/0/sp/inventory/refresh

+ 1 - 1
data/ltw/functions/state/0/tick5.mcfunction

@@ -20,7 +20,7 @@ execute if score #ready_count mem matches 3.. if score $start_countdown mem matc
 execute if score #ready_count mem matches 3.. if score $start_countdown mem matches 999.. run scoreboard players set $start_countdown mem 161
 
 # 人数不足,取消倒计时
-execute if score #ready_count mem matches ..2 if score $start_countdown mem matches ..999 run tellraw @a [{"text":" ✖ ","color":"red"}," 准备人数不足, 已取消游戏开始进程!"]
+execute if score #ready_count mem matches ..2 if score $start_countdown mem matches ..999 run tellraw @a [{"text":" ✖ ","color":"red"}," 准备人数不足, 游戏已取消!"]
 execute if score #ready_count mem matches ..2 if score $start_countdown mem matches ..999 as @a at @s run function lib:sounds/error
 execute if score #ready_count mem matches ..2 if score $start_countdown mem matches ..999 run scoreboard players set $start_countdown mem 9999999