NBT keys do not work properly in case of chests. When you do create a chest with such command:
setblock #x #y #z chest 0 replace {Items:[{Slot:0b,id:torch}]}
And test it with command:
testforblock #x #y #z chest 0 {Items:[{Slot:0b,id:torch}]}
It would not return true value. It will show you this:
The block at #x,#y,#z did not have the required NBT keys.
Hope you'll do something with it.
Linked issues
Comments 8
The datatypes are missing.
see http://minecraft.gamepedia.com/Chunk_format#Tile_Entity_Format and http://minecraft.gamepedia.com/Player.dat_Format#Item_structure
Slot is a byte, thus "Slot:0b"
Also explained in MC-30976
Still doesn't work, when used these:
setblock ~2 ~ ~ chest 5 replace {Items:[{Slot:0b,id:1b}]}
testforblock ~1 ~ ~ chest 5 {Items:[{Slot:0b,id:1b}]}
Positions' recalls are all right, the error says:
The block at -643,4,-559 did not have the required NBT keys.
A'right, it works fine now. But where from should I have know that I must use this 0: before brackets? It's not written on minecraft wiki.
Are you sure the commands you've entered are correct ?