disable_slot_8.mcfunction 359 B

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