Detect items in a chest using command blocks
//ads -- adsterra.com -- native banner
?>
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}]}
Pictures about "Detect items in a chest using command blocks"



How do you find items in a chest in Minecraft?
Item IDs can be found by pressing F3 and H at the same time (which reveals advanced tooltips) and hovering over the item in your inventory. An emerald, for example, would be "minecraft:emerald".How do you find items with command blocks?
How to Enter the CommandHow do you Testfor with command blocks?
detectPos is the x y z coordinate to detect the block. command is any Minecraft command that you want the entity to execute such as summon, give, fill, clone, setblock, tp, xp, kill, etc.how to detect item in a chest! I minecraft chest detection tutorial 1.16.5!
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Sharon McCutcheon, Anete Lusina, Sora Shimazaki, Vanessa Loring
