0

If I have a command block that is repeating, unconditional, always active with the command /testfor @p[r=5] and I approach it, then why will not the redstone dust beside it be powered?

enter image description here

3

Command blocks on their own do not produce a redstone signal. You will need a comparator pointing out of it:

Comparator usage with command block

  • Yeah, I have made this approach working, but what kind of signal will be input to the comparator in this picture? And can I power another command block with that signal? – Anders Lindén Jan 19 '17 at 18:50
  • And how come this will work even if the command block is turned like it is? – Anders Lindén Jan 19 '17 at 18:54
  • @AndersLindén The power level will be equal to how many players the command block successfully detected. In this case as @p will only find a max of 1 player, the redstone dust will only ever have a power level of 0 or 1, so you may need a repeater. You can power another command block with the signal, but you should look into using conditional chain command blocks instead for performance among other reasons. Depending on your command, you may also be able to put the @p[r=5] selector straight into it rather than having a testfor first. E.G: /give @p[r=5] .... – SirBenet Jan 19 '17 at 18:58
  • @AndersLindén Comparators will always detect the block behind them (like how they work with chests, cauldrons, etc.). The arrow on the command block points to the chain block that it'll run next. – SirBenet Jan 19 '17 at 18:59
  • If I was putting another command block beside the first, how would I power the 2nd command block from the output from the 1st command block? – Anders Lindén Jan 19 '17 at 19:13

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.