Minecraft – Detect items in a chest using command blocks

minecraft-commandsminecraft-java-edition

I'm trying to detect a chest with coal blocks and I entered in:

/testforblock -673 57 -195 chest 2 {Items:[{id:173s,Damage:0s,Slot:1b,Count:1b}]}

But below that it says:

-673,57,-195 did not have the required NBT keys

I'm running Minecraft 1.8.

Best Answer

Item IDs are saved in 1.8+ as strings containing the name IDs. You should not be using numerical IDs anymore.

/testforblock -673 57 -195 chest 2 {Items:[{id:"minecraft:coal_block",Damage:0s,Slot:1b,Count:1b}]}