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?

  • 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 '19 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!

| improve this answer | |

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.

| improve this answer | |

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