1

What I want to do is detect if any block of a wall is broken. At the moment, I have 1 command block for 1 block of the wall. This means I need several command blocks to see if any block of the wall is broken and I was wondering if there is anyway to do that with 1 command block instead? I'm in 1.12.

  • You can use the AffectedBlocks of a clone command to count how many blocks are in the wall. If it is less than what you expect, something was broken. – Sumurai8 Jul 29 '17 at 10:38
1

You can build a copy of it (or clone it) in a secure area. Then you get the lowest and the highest x, y and z coordinates of the wall (that form a box around it) and the lowest x, y and z coordinate of your copy. Then you do:

/testforblocks <x y z low> <x y z high> <x y z of copy>

A comparator will be on/a conditional command block will be executed, if the two areas are the same.

You can see the formal syntax and a more detailed explanation of the command here (archive).

  • Oh wow I didn't even realise there was a testforblocks command XD I've just been using testforblock. Thanks for the reply! – TriDeapthBear Jul 29 '17 at 22:11

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.