mojira.dev
MC-46902

testfor player-NBT-Tag Inventory

I just figured out that it isn't possible to test for a players inventory...
It works if i test for an empty inventory like so:

/testfor @e[type=Player] {Inventory:[]}

But as soon as i add something like this:

/testfor @e[type=Player] {Inventory:[{id:"minecraft:torch"}]}

it will always output false.

I wanted this to test for an item with a specific name in a specific slot.

Comments 5

You have to include other data like the data and the slot number, just having the id the game will return false because you need to give it more data, as some of the tags default to other values and if the item doesn't match those defaults it will return false.

Works as intended, see @unknown's comment.
If you don't care about the slot number, use

/clear @p minecraft:torch 0 0

Even if I give it all the data that an Item consists of.. it isn´t working :/

@unknown: Please update the issue and add the exact command you're now using.

Is this still a concern in the current Minecraft version 1.7.5 / Launcher version 1.3.9 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Robin Steiner

(Unassigned)

Unconfirmed

Minecraft 14w02c, Minecraft 14w03b, Minecraft 14w04a, Minecraft 14w04b, Minecraft 14w05a, Minecraft 14w05b

Retrieved