I want to test if a player has the following item:

minecraft:bow 1 0 {display:{Name:Bow I},ench:[{id:48,lvl:1}]}

A bow with a name of "Bow 1" and has a Power I enchantment.

I know this command works with normal items:

/testfor @p {Inventory:[{id:"minecraft:bow"}]}

I don't know how to add the attributes. Is it possible to search for a specific item name? For example, test to see if I have the item "Bow I" in my inventory?


You have to nest additional data tags in tag compound:

/testfor @p {Inventory:[{id:"minecraft:bow",tag:{display:{Name:"Bow I"},ench:[{id:48,lvl:1}]}}]}

Learn more about item format here.

| improve this answer | |
  • ahh ty, that worked ^^ – Wilmz Jan 9 '15 at 18:35

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.