I tried to test for a chest containing 10 coal. When I tried this, it didn't work:

testforblock ~-1 ~ ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:coal"}],Count:10b,Damage:0s}

It only works when I test for 1 coal, but then, I have to drop the Count and Damage tag. I want to test for 10 coal in a chest, not just for one.

  • You need to move Count and Damage to inside the item compound, the same place where id is. Note that it will only work in the top-left slot unless you remove Slot:0b.
    – tryashtar
    Apr 5, 2017 at 19:05

1 Answer 1


Use this command instead:

testforblock ~-1 ~ ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:coal",Count:10b,Damage:0s}]} 

This works because the Count and Damage keys must be between the same brackets (in the same object and the same array) as the id key.

Note, if you want to test for the items in any of the inventory's slots, remove the Slot key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .