mojira.dev
MC-48534

Testfor Inventory fails on items with custom NBT data.

I don't know if this is a bug or I am doing it incorrectly. I am trying run the testfor command to check an inventory for a bow with a custom name and lore. The commands I tried were:

testfor @p {Inventory:[{Slot:0b,id:"minecraft:bow"}],display:{Name:"Name",Lore:["LORE"]}}

and

testfor @p {Inventory:[{Slot:0b,id:"minecraft:bow",display:{Name:"Sniper",Lore:["LORE"]}}]}

The compator fails to output on both commands stating

[15:22:15] Harrnutt did not match the required data structure

Even though I do have a bow with custom name: "Name" and lore: "LORE" in my first inventory slot. Again this may just be a syntax error on my part but I've checked it and believe it should work. Thanks!

Linked issues

Comments 2

You will need to add the display inside the 'tag' tag:

testfor @p {Inventory:[{id:<id>, tag:{display:{Name:<name>, Lore:[<lore>]}}}]}

Not a Bug

Thank you so much! As I stated I believed that it could have been a syntax error. I'll take this down. Much appreciated!

Sean Harrington

(Unassigned)

Unconfirmed

Minecraft 14w07a

Retrieved