I am trying to make a custom crafting table using a dropper. I use this command to detect a shovel that is placed in the dropper:
testforblock 193 58 -314 minecraft:dropper 0 {Items:[0:{id:minecraft:stone_shovel,Count:1b,Damage:0s,Slot:4b}]}
And it works, it detects the shovel in the middle as it is supposed to.
So the shovel is in the middle right now, and the comparator activates. If I keep the shovel there, and put another item into a different slot, the redstone comparator still activates. I want it to only activate when there is 1 item in the table.
My idea is to detect air for the other 8 slots, but it is not working, is minecraft:air
invalid?
How do I make /testforblock
detect air (blank slot) inside the container (dropper)?
Best Answer
"air" is indeed not a valid inventory item. Slots without items will simply not exist whatsoever, so you cannot directly detect them through NBT.
What you'll need to do instead is use multiple
/testforblock
commands: one to detect the shovel and others to detect slots having any items in them. You'd only allow a signal to pass if the first succeeds while the others fail:Must succeed:
Must all fail:
What you cannot do is combine all of the failure commands into one, because then it's looking for an item in every one of those slots rather than any one.