I want to have command blocks behave as if they were executing the old /testfor command, whereas if what it's testing for is true, it allows comparators to output a signal. Or, is there a more efficient way of doing this?

closed as too broad by Wrigglenite, Virusbomb, Wondercricket, arghtype, Lore Friendly Apr 26 at 3:44

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    I'm leaning towards rolling this back, as you got an answer prior to your edit. You can always ask another question for your new one. – Frank Apr 25 at 2:51

In 1.9 and after, you can click on the command block and click Unconditional to change it to a conditional command block. The way those work is if the previous command block returns something that is not null, then the conditional command block will then run its command.

So say you have an execute command that runs an if command, and another command that is set to Conditional. If the if command returns true, then the rest of the execute command will run and the conditional command block will run, but if the if command returns false, then the execute command will quit, and the game will move on to the next unconditional command block, which means that the conditional command block will not run.

Hope this helps!


The way that was already recommended for a long time is using /execute to execute commands based on the conditions you want. /execute also has a lot of other features, like executing commands in other locations, from other entities, etc.

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