ソースを参照

增加tnt显示

HerobrineXia 5 年 前
親
コミット
99a2baf6b3

+ 6 - 0
data/mini/functions/hotpm/game/pm_show.mcfunction

@@ -0,0 +1,6 @@
+# 返还物品
+execute if data entity @s Inventory[{Slot:8b}] run scoreboard players set @s item_slot 8
+execute if data entity @s Inventory[{Slot:8b}] at @s run function item:pop_slot/return_item
+
+# 给予tnt显示
+replaceitem entity @s hotbar.8 tnt{game_item:1b,display:{Name:'[{"text":"你是TNT的持有者","color":"white","italic":false}]'}}

+ 4 - 0
data/mini/functions/hotpm/tick2.mcfunction

@@ -12,6 +12,10 @@ execute if score $countdown_fast mem matches 0 if entity @a[tag=pm_holding] run
 # 检测土豆
 function mini:hotpm/game/pm_check
 
+# 往手上塞tnt
+execute as @a[tag=pm_holding] unless data entity @s Inventory[{Slot:8b,tag:{game_item:1b},Count:1b}] run function mini:hotpm/game/pm_show
+execute as @a[tag=!pm_holding] if data entity @s Inventory[{tag:{game_item:1b}}] run clear @s tnt{game_item:1b}
+
 # HUD
 scoreboard players set $bossbar_color mem 0
 scoreboard players set @a[tag=pm_holding] bossbar_color 1

+ 2 - 1
data/mini/tags/items/game_item.json

@@ -11,6 +11,7 @@
         "minecraft:bricks",
         "minecraft:mossy_cobblestone",
         "minecraft:purpur_block",
-        "minecraft:prismarine"
+        "minecraft:prismarine",
+        "minecraft:tnt"
     ]
 }