2

I've recently heard about a command which can detect blocks in an area, the /testforblocks (with an s at the end, to not confuse with /testforblock) command. In this command, there the x1, y1, z1, x2, y2, z2, but also a supplementary x y z:

testforblocks <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [mode]

Because of this little detail, I can't complete my small project. Thank you very much paying attention at my question.

1 Answer 1

4

The first set of coordinates (x1/y1/z1 to x2/y2/z2) are the bounding box of the initial structure, while the supplementary x/y/z coordinates are the lower north-west corner of the location you want to compare to.

In the following image, the yellow glass represents x1/y1/z1, the blue glass represents x2/y2/z2, and the white glass represents x/y/z (assuming the player is facing north):

Left: initial, right: target

The command specifically compares two structures rather than searching for a block anywhere in the area. In the image (if replacing the glass with redstone blocks), the two structures do not match because the target structure is missing a block in the middle (which must be a redstone block instead), so the command fails.

1
  • So it's mean that if I add a clock to the command block plus the comparator, the command will serve at nothing? So outside of the command, how do I use it? I do simply put a comparator and power the command block?
    – Kimatuy
    Apr 7, 2016 at 23:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .