I'm trying to make Thor's hammer and armor, but I need to execute when someone is wearing Thor's armor, because i am trying to do lightning when someone kills 10 entities and i want only with Thor's armor and hammer could "rage" (make lightning).


Give the armor items a custom item tag so that they're easy to detect and impossible to fake:

give @p iron_chestplate 1 0 {thorArmor:1b,display:{Name:"Thor's Chestplate"},Unbreakable:1b}

Then whenever you want to do something with players who are wearing the armor, run these commands:

scoreboard players tag @a[tag=wearingThorChest] remove wearingThorChest
scoreboard players tag @a add wearingThorChest {Inventory:[{Slot:102b,tag:{thorArmor:1b}}]}
say @a[tag=wearingThorChest] is/are wearing Thor's Chestplate!

102b is the chest armor slot. You can find the other slot numbers on the Wiki: https://minecraft.gamepedia.com/Player.dat_format#Inventory_slot_numbers

You can do something similar with the mainhand item:

scoreboard players tag @a[tag=holdingMjolnir] remove holdingMjolnir
scoreboard players tag @a add holdingMjolnir {SelectedItem:{tag:{thorHammer:1b}}}
say @a[tag=holdingMjolnir] is/are holding Mjolnir!

This command tests for all players wearing a diamond helmet called "Thor's helmet" and a diamond chestplate called "Thor's chestplate":

/testfor @a {Inventory:[{Slot:103,id:"minecraft:diamond_helmet",Count:1,tag:{display:{Name:"Thor's helmet"}}},{Slot:102,id:"minecraft:diamond_chestplate",Count:1,tag:{display:{Name:"Thor's chestplate"}}}]}

It this doesn't work, please tell me, then I can fix it. Currently I'm not on my PC, so I can't test it.

  • Apparently I had this tab open for a very long time, I didn't see the already accepted answer when I wrote mine. The other answer is better than mine. Oct 1 '17 at 9:47

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.