I want to detect if there isn't any item in a specific slot. If the item is not there, one command should run. I tried this command but it won't resolve my problem

/testforblock ~ ~ ~ dropper -1 {Items:[0:{Slot:4b}]}

.. no results..

Can someone help me out?


You will first need to detect the existence of any item in that slot, and then invert the output. For example, you would run your command as normal:

/testforblock X Y Z minecraft:dropper -1 {Items:[{Slot:4b}]}

And then check the SuccessCount value of that command block. If it's 0, that command failed. Replace the coordinates with that of the above command block's coordinates:

/testforblock X Y Z minecraft:repeating_command_block -1 {SuccessCount:0}

And then the above command block will succeed if the other command block failed.

| improve this answer | |

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.