Jelajahi Sumber

修复大厅物品乱丢现象

HerobrineXia 5 tahun lalu
induk
melakukan
737c36d5ea

+ 1 - 1
data/item/functions/shop/summon_emerald.mcfunction

@@ -1,5 +1,5 @@
 # 给予绿宝石
-summon item ~ ~ ~ {Item:{id:"emerald",Count:1b},Tags:["score_item"],PickupDelay:0}
+summon item ~ ~ ~ {Item:{id:"emerald",Count:1b,tag:{stats_item:1b}},Tags:["score_item"],PickupDelay:0}
 execute if score @s temp matches 1..64 store result entity @e[type=item,tag=score_item,limit=1] Item.Count byte 1 run scoreboard players get @s temp
 execute if score @s temp matches 65.. run data modify entity @e[type=item,tag=score_item,limit=1] Item.Count set value 64b 
 data modify entity @e[type=item,tag=score_item,limit=1] Owner set from entity @s UUID

+ 1 - 1
data/item/functions/shop/summon_emerald_block.mcfunction

@@ -1,5 +1,5 @@
 # 给予绿宝石块
-summon item ~ ~ ~ {Item:{id:"emerald_block",Count:1b},Tags:["score_item"],PickupDelay:0}
+summon item ~ ~ ~ {Item:{id:"emerald_block",Count:1b,tag:{stats_item:1b}},Tags:["score_item"],PickupDelay:0}
 execute if score @s temp matches 1..64 store result entity @e[type=item,tag=score_item,limit=1] Item.Count byte 1 run scoreboard players get @s temp
 execute if score @s temp matches 65.. run data modify entity @e[type=item,tag=score_item,limit=1] Item.Count set value 64b 
 data modify entity @e[type=item,tag=score_item,limit=1] Owner set from entity @s UUID

+ 1 - 1
data/item/functions/shop/summon_gold.mcfunction

@@ -1,5 +1,5 @@
 # 给予金锭
-summon item ~ ~ ~ {Item:{id:"gold_ingot",Count:1b},Tags:["score_item"],PickupDelay:0}
+summon item ~ ~ ~ {Item:{id:"gold_ingot",Count:1b,tag:{stats_item:1b}},Tags:["score_item"],PickupDelay:0}
 execute if score @s temp matches 1..64 store result entity @e[type=item,tag=score_item,limit=1] Item.Count byte 1 run scoreboard players get @s temp
 execute if score @s temp matches 65.. run data modify entity @e[type=item,tag=score_item,limit=1] Item.Count set value 64b 
 data modify entity @e[type=item,tag=score_item,limit=1] Owner set from entity @s UUID

+ 1 - 1
data/item/functions/shop/summon_gold_block.mcfunction

@@ -1,5 +1,5 @@
 # 给予金块
-summon item ~ ~ ~ {Item:{id:"gold_block",Count:1b},Tags:["score_item"],PickupDelay:0}
+summon item ~ ~ ~ {Item:{id:"gold_block",Count:1b,tag:{stats_item:1b}},Tags:["score_item"],PickupDelay:0}
 execute if score @s temp matches 1..64 store result entity @e[type=item,tag=score_item,limit=1] Item.Count byte 1 run scoreboard players get @s temp
 execute if score @s temp matches 65.. run data modify entity @e[type=item,tag=score_item,limit=1] Item.Count set value 64b 
 data modify entity @e[type=item,tag=score_item,limit=1] Owner set from entity @s UUID

+ 1 - 1
data/item/functions/shop/summon_nugget.mcfunction

@@ -1,5 +1,5 @@
 # 给予金粒 
-summon item ~ ~ ~ {Item:{id:"gold_nugget",Count:1b},Tags:["score_item"],PickupDelay:0}
+summon item ~ ~ ~ {Item:{id:"gold_nugget",Count:1b,tag:{stats_item:1b}},Tags:["score_item"],PickupDelay:0}
 execute if score @s temp matches 1..64 store result entity @e[type=item,tag=score_item,limit=1] Item.Count byte 1 run scoreboard players get @s temp
 execute if score @s temp matches 65.. run data modify entity @e[type=item,tag=score_item,limit=1] Item.Count set value 64b 
 data modify entity @e[type=item,tag=score_item,limit=1] Owner set from entity @s UUID

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

@@ -48,3 +48,8 @@ execute if score #start_countdown mem matches 0 run function ltw:state/0/start_g
 # 显示信息
 execute if score #start_countdown mem matches 1..199 run title @a actionbar [{"text":"","color":"green"},{"score":{"name":"$count","objective":"mem"}},"/",{"score":{"name":"#total_count","objective":"mem"}}," 人已准备 | ","将在 ",{"score":{"name":"#start_sec","objective":"mem"}}," 秒后开始游戏"]
 execute if score #start_countdown mem matches 200.. run title @a actionbar [{"text":"","color":"red"},{"score":{"name":"$count","objective":"mem"}},"/",{"score":{"name":"#total_count","objective":"mem"}}," 人已准备 | 需要 3 人以开始游戏"]
+
+# 处理乱扔物品的玩家
+execute as @e[type=item,nbt={Item:{tag:{stats_item:1b}}}] at @s as @a[distance=..2] at @s run function item:shop/refresh_gold
+execute as @e[type=item,nbt={Item:{tag:{stats_item:1b}}}] at @s as @a[distance=..2] at @s run function item:shop/refresh_green
+execute as @e[type=item,nbt={Item:{tag:{stats_item:1b}}}] run kill @s