The order in which we execute commands can be as equally important as the commands themselves.
To become great at command blocks, one must have a solid understanding of order.
In this article, I discuss the order in which command blocks update when powered by a Block of Redstone and how blocks propagate when using the fill command.
When a block is placed in a world, it causes the six adjacent blocks around it to update.
Imagine we have an air block completely surrounded on all sides by six command blocks. If we use a setblock command to replace the enclosed air block with a Block of Redstone, all of the Command Blocks will update, causing them to run their respective commands.
However, multiple updates can’t occur simultaneously.
Instead, the commands are put into a queue and run one at a time in the span of a single game tick. The order of the queue is based on the block’s position around the Block of Redstone, with the block touching the west (-x) face being first, followed by the east (+x), bottom (-y), top (+y), north (-z), and south (+z) faces.
Update order is always the same, regardless of location.
Now that we have a better understanding of update order, let’s move on to fill propagation.
The fill command can be thought of as a series of setblock commands occurring in a single game tick, but they too have an update order.
Understanding this order is like reading a book.
Imagine words are our X axis, lines are Y, pages are Z, and you read from low to high values. When reading, our eyes scan words from left to right until they reach the end of a line, then they return to the far left and go down a line. This process is repeated until there are no more lines to scan, at which point the page is turned and the whole process begins again at the top of the page. The fill command works in the same way.
Starting at the block with the lowest X, Y, and Z value, blocks fill from west (-x) to east (+x) until they reach the end of the line, then they fill the line above (+y), again from west (-x) to east (+x). This process is repeated until there are no more lines above, at which point the fill moves south (+z) and whole process begins again starting at the block with the lowest X and Y value.
Fill order is always the same, regardless of the order we specify the coordinates.
Putting It Together
Taking what we know about update order and fill propagation, we can now accurately determine the order our command blocks run. Below are the six most commonly used fill strip shapes and their orders.
I hope this has been helpful to you.
Until next time,