Hello I have recently been trying to use the /test for block command to test if certain items are in a chest and then award money via a score board. However i cannot the /testforblock command to work properly;
Hello I have recently been trying to use the /test for block command to test if certain items are in a chest and then award money via a score board. However i cannot the /testforblock command to work properly;
each time the command block output is "The block at x y z did not have the required NBT keys.
There is a bug concerning the /testforblock (and other random tags/commands), specifically for the "Items" tag. The bug requires you to include specific tags and label their tag-types.
The tags you must include are: "id", "Damage", "Count", and "Slot".
"id" and "Damage" are both tag-types of "short", thus you label with "s".
"Count" and "Slot" are both tag-types of "byte", thus you label with "b".
You must order each of the items in the chest by the "Slot" tag, so the item in Slot 0 must be listed first, followed by the item in Slot 1 (if applicable), then 2, and so on.
Just going to copy my reply from there to here for others looking for an answer:
There is a bug concerning the /testforblock (and other random tags/commands), specifically for the "Items" tag. The bug requires you to include specific tags and label their tag-types.
The tags you must include are: "id", "Damage", "Count", and "Slot".
"id" and "Damage" are both tag-types of "short", thus you label with "s".
"Count" and "Slot" are both tag-types of "byte", thus you label with "b".
You must order each of the items in the chest by the "Slot" tag, so the item in Slot 0 must be listed first, followed by the item in Slot 1 (if applicable), then 2, and so on.
Now you need to use alphanumerical id's. Also if you use this exact command make sure that the chest is facing the right way, that its coordinates are correct and the correct item is in there.
I have tried this:
/testforblock ~ ~1 ~ chest 2 {Items:[{id:5,Slot:0,Count:1}]}
/testforblock ~ ~1 ~ chest 2 {Items:[{id:planks,Slot:0,Count:1}]}
each time the command block output is "The block at x y z did not have the required NBT keys.
i have also posted this in discussion
There is a bug concerning the /testforblock (and other random tags/commands), specifically for the "Items" tag. The bug requires you to include specific tags and label their tag-types.
The tags you must include are: "id", "Damage", "Count", and "Slot".
"id" and "Damage" are both tag-types of "short", thus you label with "s".
"Count" and "Slot" are both tag-types of "byte", thus you label with "b".
You must order each of the items in the chest by the "Slot" tag, so the item in Slot 0 must be listed first, followed by the item in Slot 1 (if applicable), then 2, and so on.
So your fixed command would read:
This particular bug is not going to be fixed, as stated by Mojang.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
Thank you i will try this out in the building of my server as soon as i can.
Bro u a geniusss!!!! Thanks for that it worked for me!!!!!
Thank you so much that worked!!!
How do you test for items in a trapped chest. I want to make a mystery chest that plays sounds according to the rarity of the prize.
i used
testforblock ~-2 ~1 ~-1 chest 2 {Items:[{id:"minecraft:cobblestone",damage:0s,Count:1b,Slot:0b},{id:"minecraft:stone",damage:0s,Count:1b,Slot:1b}]}
but it still said the NTB key thing help plz (btw i tried without the " )
ps im on 1.8.8
ok so i did
testforblock ~-2 ~1 ~-1 chest 2 {Items:[{id:"minecraft:cobblestone",Damage:0,Count:1,Slot:0},{id:"minecraft:stone",Damage:0,Count:1,Slot:1}]}
and it still did not work
omg thanks soo much ive been trying to do this for ages but now i can make my map thx =D