mojira.dev
MC-118175

Dropped items can't be found when a data value is specified

I experimented a bit with this and here is what I've found:

Dropped items can be found when a data value is not specified.

/scoreboard players tag @e[type=item] add stone {Item:{id:"minecraft:stone"}}

works without issues.

When a data value is then specified, the command no longer works, and gives an error message saying the item did not have a matching data tag.

/scoreboard players tag @e[type=item] add stone {Item:{id:"minecraft:stone",Damage:0}}

does not work.

This holds true for all dropped item entities.

Comments 1

You search for an int named Damage, but it's a short, not an int.

Testing for data requires the correct data types.
Use

{Item:{id:"minecraft:stone",Damage:0s}}

Jason Kristol

(Unassigned)

Unconfirmed

Minecraft 1.12 Pre-Release 7

Retrieved