I'm confused about the tag part of the command, I don't know what tag my item has. The item has been renamed.

This is the command I'm using:

execute as @a if entity @s  
tag:{Tags:["**I do not know what the tag is**"],  
display:{Name:"{\"text\":\"Stealth Chestplate\"}"}}}]}]  
run effect give @s minecraft:invisibility 1 1

1 Answer 1


Using the stuff I found here, I figured out how to do this.

First, you need the item with the appropriate tag.

give @s chainmail_chestplate{tag:{Tags:[sneaky]}}

How tags work in datapacks is they allow commands to locate and isolate items from other items. Datapacks cannot add new content, only modify to make it appear to be differing from it's parent item. All your other NBT data (renaming, lore, enchantments, etc) still work with tags. They are just more reliable when it comes to locating where an item is and who has it.

Now that you have the item with the appropriate tag, we can now detect and execute.

execute as @e[nbt={Inventory:[{id:"minecraft:chainmail_chestplate", tag:{Tags:[sneaky]}, Slot: 102b}]}] run **The effect command with desired effect**

I used the @e target selector so you can use this item on zombies, skeletons, etc. But if this is a player-only item you should change the selector to @a.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .