In my custom map there is a point where the items in the chest have to be tested, so I wrote this command:
/testforblock -17 105 198 minecraft:chest 5 {Items:[{id:1,Slot:0,Count:64},{id:1,Slot:1,Count:64},{id:1,Slot:2,Count:64},{id:1,Slot:3,Count:64},{id:1,Slot:4,Count:64},{id:1,Slot:5,Count:64},{id:1,Slot:6,Count:64},{id:1,Slot:7,Count:64},{id:1,Slot:8,Count:64},{id:1,Slot:9,Count:64},{id:1,Slot:10,Count:64},{id:1,Slot:11,Count:64},{id:1,Slot:12,Count:64},{id:1,Slot:13,Count:64},{id:1,Slot:14,Count:4}]}
To a command block (and kept it in a loop of 1/2 of a second) but it gives the following error:
The block at -17,105,198 did not have the required NBT keys.
But there is a chest there 100% (if thats the case). I will leave a screenshot of the chests so to determine if there is any placement issue. Layout of my chest:
Best Answer
When testing for pre-existing NBT data, you must specify all data as it was stored. This includes proper string values for item IDs (you should not be using numerical IDs to begin with) as well as correct datatype declaration for all data.
The
id
tag stores a string, being the name ID of the item (including the namespace, defaulting to "minecraft"). Both theSlot
andCount
tags are stored as bytes, so you append the whole numerical value with a "b".Fixed command: