So I tried to give an item with a special tag to me which is executing a command while holding in the offhand. The give command works only execute doesn't.

minecraft:give @p minecraft:sugar{Damage:-100,display:{Name:"{\"text\":\"Boost\"}"},HideFlags:3,Tags:["movement_charge_item"],Enchantments:[{id:"minecraft:power",lvl:0}]} 1

minecraft:execute as @a[nbt={Inventory:[{Slot:-106b,tag:movement_charge_item}]}] run say hello
  • Why are you putting minecraft: before your commands? It's not supposed to be there. – ExpertCoder14 Jul 11 at 17:03
  • sorry for not mentioning it in my case minecraft: is required. – Lucas8282 Jul 16 at 15:08
  • And why is that? – ExpertCoder14 Jul 16 at 21:34
  • Because of a plugin. – Lucas8282 Jul 18 at 16:42

Your custom list named Tags is different from tag. Instead, put Tags:["movement_charge_item"] inside tag:{}.

/execute as @a[nbt={Inventory:[{Slot:-106b,tag:{Tags:["movement_charge_item"]}}]}] run say hello
| improve this answer | |
  • Thank you that worked :) – Lucas8282 Jul 16 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.