I'm working on an adventure map with quests etc, and need to testfor a player with a certain item in their inventory. The item in question is a custom head with a few attributes–here's the /give command I used for it:

/give @p skull 1 3 {LeafyHeaddress:1b,display:{Name:"Leafy Headdress",Lore:["[Rare] [Quest Item]","Some irritating thorns poke out of it."]},SkullOwner:{Id:"8dc9da4f-e33d-2a9b-fd5f-39628f3c4bb4",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDNkYjgxNDRhMjNjYzU4NTkzMTU2M2VkNDMzMGE5ODYyYjhkNzk4ZWE0YjE1ZTNlMzE4YWM2NDk0Mzg0MSJ9fX0="}]}},AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:0.15,Operation:1,UUIDMost:10481,UUIDLeast:32056}],ench:[{id:7,lvl:1}]}

I saw in another post that I could detect it with a custom tag, which I tried to use above ^ (LeafyHeaddress)

The command I'm using to test for it is: /testfor @a {Inventory:[{tag:{LeafyHeaddress:1b}}]} Problem is, the command block outputs nothing when a player has the item. The error simply says that the player in question did not "match the required data structure" (which I take to mean it didn't detect the item)

So, how can I fix this? ;-;

*note: if you couldn't tell, I'm really bad at command blocks and all this is just stuff I strung together from various sources.

  • Though I do not use commands, I have read up on it and it seems the leafy headdress's id isn't correct. All minecraft id's are defined with a "minecraft." tag (like "minecraft.bed") in recent updates (like 1.7 or 1.8?) Maybe it would be worth trying to get the exact id internal of the headdress instead of using it's name. – The Mattbat999 Jun 11 '17 at 21:57
  • The ID for it is minecraft:skull, i just gave it a special tag, and should be able to identify it with said tag. – sunneh Jun 13 '17 at 19:30

Create scoreboard wSkull: scoreboard objectives add wSkull dummy

[1]Repeating command block: scoreboard players set @a wSkull 1 {Inventory:[{Slot:103b,id:"minecraft:skull",tag:{display:{Name:"Leafy Headdress",Lore:["[Rare] [Quest Item]","Some irritating thorns poke out of it."]}}}]}

[2]Repeating command block: execute @a[score_wSkull_min=1] ~ ~ ~ [command you want to happen when the custom head was worn]

At [2]Repeating command block, you can do multiple of these if you want alot of things to happen whoever wears your head.

Slot:103b locates where the helmet should be put when you want to wear it inside your inventory.


the 1b part isn't necessary. Instead do the following: /give @p minecraft:skull 1 3 {SkullOwner:"[LeafyHeaddress]"}

  • 1
    Can you elaborate more? What does each part of the command do? – Timmy Jim Jul 7 '17 at 13:44

Try this:

/testfor @a {Inventory:[{Slot:103b,id:"minecraft:skull",tag:{display:{Name:"Leafy Headdress"}}}]}

I think in testfor.Inventory, id is required.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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