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
Works as intended, see @unknown's comment.
If you don't care about the slot number, use
/clear @p minecraft:torch 0 0
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.