Minecraft – How to test for a player wearing specific armor

minecraft-commandsminecraft-java-edition

How can I test for a player that is wearing an iron helmet named "test1" and an iron chestplate named "test2" in Minecraft Version 1.12?

Best Answer

Although you can't set player data with commands, you can test for it, in your example it's like this:

/execute as @p[nbt={Inventory:[{Slot:103b,id:"minecraft:iron_helmet",tag:{display:{Name:"{\"text\":\"test1\"}"}}},{Slot:102b,id:"minecraft:iron_chestplate",tag:{display:{Name:"{\"text\":\"test2\"}"}}}]}] run <command>
Related Topic