So I have come across some troubles lately. I was trying to come up with a command to find an item that a player throws on the ground, however it is slightly more complicated because it is a yellow stained glass pane (the trouble I am having is that I cannot get it to detect the colour yellow).
The current command I am using to test for the stained glass pane is this:
/testfor @e[type=Item] {Item:{id:minecraft:stained_glass_pane,Damage:4}}
I ran the command (in a repeating command block) and get no error response, but when I throw the yellow stained glass pane onto the ground, the command block doesn't react or give an output signal. If I remove the ,Damage:4
portion of the command, the command block will give an output if any glass pane is thrown.
Best Answer
When checking pre-existing NBT data, such as for
/testfor
,/scoreboard
, or/testforblock
, you must specify all data exactly as it's stored. This includes datatypes; you've declaredDamage
as an Integer, when instead it's saved as a Short. To declare it as a Short, you must append the value with ans
: