2

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.

1
  • Is there a reason you're using testfor instead of a scoreboard command? The reason I ask is because testfor is mostly useless, except for some edge cases that 1.9 and conditional command blocks open up.
    – MBraedley
    Mar 2, 2016 at 23:20

1 Answer 1

4

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 declared Damage as an Integer, when instead it's saved as a Short. To declare it as a Short, you must append the value with an s:

/testfor @e[type=Item] {Item:{id:"minecraft:stained_glass_pane",Damage:4s}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .