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)

1 Answer 1

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .