Minecraft – giving a score to an item with a Damaga value

minecraft-commandsminecraft-java-edition

I am trying to give a score of 1 to isYellowWool, which is a Yellow wool item. I have tried this command:

/scoreboard players set @e[type=Item] isYellowWool 1 {Item:{id:minecraft:wool,Damage:4}}

But it gives me this error:

The dataTag does not match for 598f6a62-8ae2-4c54-b5c4-f26e4ba340f5

Best Answer

Damage is stored as a short, rather than a normal integer. When testing for data tags you need to match the data exactly, including its type. Add s after the number to specify a short:

/scoreboard players set @e[type=Item] isYellowWool 1 {Item:{id:minecraft:wool,Damage:4s}}