mojira.dev
MC-59035

Damage tag not working in /testfor

I was creating a map, when I encountered a problem in testing for dropped items with damage values. It looks like the Damage tag doesn't work in /testfor. I dropped a sand item, then used /testfor @e[type=Item] {Item:{id:minecraft:sand,Damage:0s,Count:1}}. Minecraft responded with, "item.tile.sand.default did not match the required data structure". I tried the same thing with red sand. I used, "/testfor @e[type=Item] {Item:{id:minecraft:sand,Damage:1s,Count:1}}" This time minecraft said, "item.tile.sand.red did not match the required data structure" I am pretty sure this is a bug. I tested everything multiple times.

Linked issues

Comments 5

use:

/testfor @e[type=Item] {Item:{id:minecraft:sand,Damage:0s,Count:1}}

then it'll work

Still not working in 14w26c

I can confirm that this is a problem. I am building a CTM map, and I'm trying to test for dropped items. I want to omit the count, because I want to detect all dropped items, not just a dropped item of specific size:

I tried with Red Wool:
/testfor @e[type=Item] {Item:{id:minecraft:wool,Damage:14s}} (Doesn't work)
/testfor @e[type=Item] {Item:{id:minecraft:wool,Damage:14s,Count:1b}} (Doesn't work)

I tried with Andesite stone: (Doesn't Work)
/testfor @e[type=Item] {Item:{id:minecraft:stone,Damage:6s}}

But it does work with TestForBlock, for instance: Red Wool in Slot 0 of a Hopper: (DOES WORK!)
/testforblock -10 101 -4 hopper 0 {Items:[0:{id:minecraft:wool,Slot:0b,Count:3b,Damage:14s}]}

There is definitely something wrong with Damage value in /testfor

This appears to be fixed in 12w28b!

This seems to be broken again in 1.9.4, I tried '/testfor @e[type=Item] {Item:{id:minecraft:sand,Damage:1s,Count:1}}' next to some dropped red sand and it gave the error message 'item.tile.sand.red did not match the required data structure'.

Try

/testfor @e[type=Item] {Item:{id:minecraft:sand,Damage:1s,Count:1b}}

You have to put a b after any Count tag.

Jira Acount

(Unassigned)

Community Consensus

Minecraft 14w21b, Minecraft 14w25b, Minecraft 14w26c

Minecraft 14w30b

Retrieved