I am trying to make a commandblock detect a certain named helmet when worn. This is the code I have:
/execute if entity @a[nbt={Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{display:{Name:"Mining Helmet"}}}]}]
When removing the tag: ... part the command block will give an output, but when the tag is there it doesn't work... Anyone have an idea? I double checked if I miss spelled anything but I didn't.
I'm actually trying to achieve a very similar thing, except with more on top of it. While I'm far from knowledgable myself, I did find something that works for me which may apply to you.
My goal was to make the command detect the custom item, then give a potion effect when equipped. My named item has coloured font so there's a bit more to it, but essentially is the same idea.
/execute as @a[nbt={Inventory:[{Slot:100b,id:"minecraft:leather_boots",tag:{display:{Name:"{\"text\":\"Boots of Invisibility\",\"color\":\"gold\",\"italic\":\"false\"}"}}}]}] run effect give @s invisibility 1 0 true
Thanks! It now works! I think it had something to do with the \"text\": part before the item name.
This it what works for me:
/execute as @a[nbt={Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{display:{Name:"{\"text\":\"Mining Helmet\"}"}}}]}] run effect give @s minecraft:night_vision 100 0 true
I am trying to make a commandblock detect a certain named helmet when worn. This is the code I have:
/execute if entity @a[nbt={Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{display:{Name:"Mining Helmet"}}}]}]
When removing the tag: ... part the command block will give an output, but when the tag is there it doesn't work... Anyone have an idea? I double checked if I miss spelled anything but I didn't.
Help would be appreciated!
I'm actually trying to achieve a very similar thing, except with more on top of it. While I'm far from knowledgable myself, I did find something that works for me which may apply to you.
My goal was to make the command detect the custom item, then give a potion effect when equipped. My named item has coloured font so there's a bit more to it, but essentially is the same idea.
/execute as @a[nbt={Inventory:[{Slot:100b,id:"minecraft:leather_boots",tag:{display:{Name:"{\"text\":\"Boots of Invisibility\",\"color\":\"gold\",\"italic\":\"false\"}"}}}]}] run effect give @s invisibility 1 0 true
Thanks! It now works! I think it had something to do with the \"text\": part before the item name.
This it what works for me:
/execute as @a[nbt={Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{display:{Name:"{\"text\":\"Mining Helmet\"}"}}}]}] run effect give @s minecraft:night_vision 100 0 true
Anyway thanks alot!