/setblock ~0 ~1 ~0 154 0 replace {Items:[:{Count:1,Slot:2,id:35,Damage:15}]}
can spawn a hopper with items inside just fine, however
/testforblock ~0 ~1 ~0 154 0 {Items:[:{Count:1,Slot:2,id:35,Damage:15}]}
will return:
The block at x,y,z did not have the required NBT keys.
Linked issues
is duplicated by 9
relates to 1
Attachments
Comments 56
It does say "required" in the error message, so one would think that the tags you supply must be there and not that the block should only have those tags. Besides, what about checking for certain items in a chest with 27 individual slots to test for? That seems like an awful lot of text to see if a chest has a named diamond sword in a specific slot.
I am led to believe there are tags being filled in that we aren't seeing. After all, there is no way to see them.
Still an issue as of 13w08c . If there are tags being added "invisibly", I'd call it a bug, because it's being made pretty much impossible to use this feature.
Confirmed as well, with hoppers and chests. Assuming this happens with all other container blocks. Trying out other blocks with other NBT tags, such as a command block with a CustomName tag, works just fine.
I haven't heard anything about invisible NBT tags. There's a nifty third-party program called NBT Explorer which lets you view all of the tags a block has. I've matched the /testforblock tag for tag with a chest and it made no difference.
Yes, the head is renamed using an anvil. Even if I add a blank Lore tag, it doesn't work. (Even a blank tag tag doesn't work)
The workaround by @unknown does not work anymore in 14w04a.
/testforblock ~ ~+1 ~ chest 0 {Items:[0:{Slot:0b,id:1s,Damage:0s,Count:1b}]}
14w03 has switched over to the new item format. You have to label the correct item ID, complete with "minecraft:":
/testforblock ~ ~+1 ~ chest 0 {Items:[0:{Slot:0b,id:minecraft:stone,Damage:0s,Count:1b}]}
Working for me sometimes but not others... works with just the one stone block but not a whole array of items...
I don't think its an issue, I think we (I have this issue too) just aren't including all the tags.