disable_slot_7.mcfunction 359 B

1234
  1. clear @s red_dye{LockItem:1b,LockSlot:7b}
  2. execute if data entity @s Inventory[{Slot:7b}] run scoreboard players set @s item_slot 7
  3. execute if data entity @s Inventory[{Slot:7b}] at @s run function item:pop_slot/return_item
  4. item replace entity @s hotbar.7 with red_dye{LockItem:1b,LockSlot:7b,display:{Name:'{"text":"已锁定","color":"red","italic":false}'}}