How can we change the comparing area of the /testforblocks command?

How can we change the comparing area of the /testforblocks command? - White Smoke Coming Out from a Building

What I wanted to do was a system that would permit you to save your build in an area, in sort of a nothing is changeable, not even the items in a chest.
In fact, how it works is simple: the construction would be cloned into a safe area when the system is in "save mode".

I just want to add a last thing: with the /testforblocks (with an s) command, the system will detect if something was changed during the "save mode" and then change it back to what it was.

How can we change the comparing area of the /testforblocks command?



Best Answer

You can find out how the /testforblocks command works here. The syntax is exactly the same as the /clone command. Basically, the first two sets of coordinates specify the two corners of the first cuboid region you want to test, and the third set of coordinates specifies the lower northwestern corner of the cuboid region you want to test your first region to. Both regions will be the same size. In more recent versions of Java Edition Minecraft you can tell which corner of your structure is the lower northwestern corner by hitting F3 and looking at the axes in the center of your screen; whichever corner or your region fits into those axes is the lower northwestern corner of that region. This same trick applies to the /clone command.

In 1.13+, the /testforblocks command was moved into the /execute command to make it easier to compare regions and due something accordingly in the same command. Instead of using the command

/testforblocks 0 0 0 5 10 5 20 10 20

you can use

/execute if blocks 0 0 0 5 10 5 20 10 20

and modify the command to fit what you want. You can read more about the /execute command here.

I'm aware that this post is 3 years old, but this seems like an important question to answer as the syntax of the /clone and /testforblocks commands are very confusing.




Pictures about "How can we change the comparing area of the /testforblocks command?"

How can we change the comparing area of the /testforblocks command? - Person Holding Can With Blue and White Knit Sweater
How can we change the comparing area of the /testforblocks command? - Close-Up Photograph of a Can
How can we change the comparing area of the /testforblocks command? - Young Couple Looking at Their Smart Phones



What is the testforblock command for?

You can test whether there is a certain block at a specific location in the game using the /testforblock command in Minecraft.



/Testforblock and /Testforblocks Command Basics




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Marcin Jozwiak, Anna Shvets, Tima Miroshnichenko, Karolina Grabowska