1

I'd like to use a command block to detect when the first slot of a hopper has no items in it in 1.12.2 (Or alternatively, if no slots have items in them). I already know how to search for a specific item in the first slot:

/testforblock ~a ~b ~c hopper -1 {Items:[{id:"minecraft:dirt",Count:1b,Slot:0b}]}

I've tried to search for minecraft:air as a way to detect nothing, but this doesn't seem to work. Any help is appreciated! It must be a command block solution (I know that you can detect an empty hopper "manually" by having a comparator output with redstone torch, but in my scenario the hopper and signal destination (command block location) are very far apart)

3

In Minecraft 1.12.2, you can detect a hopper with no items in it with the command:

/testforblock <x> <y> <z> hopper -1 {Items:[]}

in one command block, followed by a conditional chain command block to do something when this is true.

  • Wow I seriously overthought that... thank you! – Andrew Apr 26 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.