Browse Source

修复吞物品的bug

HerobrineXia 5 years ago
parent
commit
be47fa4d82

+ 2 - 1
data/ltw/functions/state/0/state/join_game.mcfunction

@@ -2,7 +2,8 @@
 clear @s lime_dye{lobby_item:1b,lobby_ready:1b}
 clear @s gray_dye{lobby_item:1b,lobby_watch:1b}
 kill @e[type=item,nbt={Item:{id:"minecraft:gray_dye",tag:{lobby_item:1b,lobby_watch:1b}}}]
-execute if data entity @s Inventory[{Slot:8b}] unless data entity @s Inventory[{Slot:8b,tag:{lobby_item:1b,lobby_watch:1b}}] at @s run function item:disable_slot/disable_slot_8
+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
 replaceitem entity @s hotbar.8 lime_dye{lobby_item:1b,lobby_ready:1b,display:{Name:'[{"text":"已准备 (按 ","color":"green","italic":false},{"keybind":"key.drop","color":"green","italic":false},{"text":" 切换)","color":"green","italic":false}]',Lore:['{"text":"你将在下一局参与游戏","color":"gray","italic":false}']}}
 execute at @s run function lib:sounds/hit
 

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

@@ -2,7 +2,8 @@
 clear @s lime_dye{lobby_item:1b,lobby_ready:1b}
 clear @s gray_dye{lobby_item:1b,lobby_watch:1b}
 kill @e[type=item,nbt={Item:{id:"minecraft:lime_dye",tag:{lobby_item:1b,lobby_ready:1b}}}]
-execute if data entity @s Inventory[{Slot:8b}] unless data entity @s Inventory[{Slot:8b,tag:{lobby_item:1b,lobby_ready:1b}}] at @s run function item:disable_slot/disable_slot_8
+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
 replaceitem entity @s hotbar.8 gray_dye{lobby_item:1b,lobby_watch:1b,display:{Name:'[{"text":"旁观 (按 ","color":"white","italic":false},{"keybind":"key.drop","color":"white","italic":false},{"text":" 切换)","color":"white","italic":false}]',Lore:['{"text":"你将在下一局旁观游戏","color":"gray","italic":false}']}}
 execute at @s run function lib:sounds/hit2
 

+ 4 - 0
data/mini/functions/colormatch/game/show_floor_block.mcfunction

@@ -10,6 +10,10 @@ clear @s mossy_cobblestone{game_item:1b}
 clear @s purpur_block{game_item:1b}
 clear @s prismarine{game_item:1b}
 
+# 返还格子上的物品
+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
+
 # 物品栏显示
 execute if score $color_match_current mem matches 1 run replaceitem entity @s hotbar.8 acacia_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}
 execute if score $color_match_current mem matches 2 run replaceitem entity @s hotbar.8 birch_planks{game_item:1b,display:{Name:'[{"text":"本轮的地板方块","color":"white","italic":false}]'}}

+ 1 - 1
data/mini/functions/colormatch/tick2.mcfunction

@@ -4,7 +4,7 @@ execute as @a[tag=mini_running] at @s if block ~ ~-1 ~ magma_block run function
 execute as @a[tag=mini_running] at @s if block ~ ~-2 ~ magma_block run function mini:colormatch/player_lose_heart
 
 # 检测玩家背包
-execute as @a[tag=mini_running] unless data entity @s Inventory[{Slot:8b,tag:{game_item:1b}}] if data entity @s Inventory[{tag:{game_item:1b}}] run function mini:colormatch/game/show_floor_block
+execute as @a[tag=mini_running] unless data entity @s Inventory[{Slot:8b,tag:{game_item:1b}}] run function mini:colormatch/game/show_floor_block
 
 # 开始新的一轮
 execute if score $countdown_fast mem matches 0 if score $color_match_type mem matches 0 run function mini:colormatch/game/remove_ground

+ 5 - 0
data/mini/functions/phantom/game/give_trident.mcfunction

@@ -1,2 +1,7 @@
 clear @s trident{game_item:1b}
+
+# 返还格子上的物品
+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
+
 replaceitem entity @s hotbar.8 trident{Damage:248,game_item:1b,display:{Name:'{"text":"补给用三叉戟","italic":false}'}} 1