Often, when asking about command block contraptions, people suggest using a “setblock” or “fill” clock?
What are those and how do I make them?
First off, if you are playing in Minecraft 1.9 or later, you don’t need to use these clocks. Repeating and chain command blocks have the same functionality (see below) and more, and are much easier to use. Use them instead.
What are those?
A setblock or fill clock is a command block contraption based on using the
/fill commands to alternately set redstone blocks and regular blocks in the same spot, therefore activating adjacent command blocks 20 times a second. They are therefore also referred to as “20Hz” clocks.
They are extremely useful for making command block contraptions for multiple reasons:
- Faster than any redstone based clock.
- Well-defined execution order: This may seem odd, but while every command is executed at the same time, the placement of the command blocks still determines the order this happens in.
This allows you to, for example, set a scoreboard objective to 0 for everyone, and to 1 for certain players directly afterwards, without their score “flickering”.
- Virtually lag-free: Redstone dust is laggy, mostly due to block updates and lighting updates around it. Don’t use redstone dust. Just don’t. A setblock/fill clock has no lighting updates, and few block updates. By a similar logic, you should limit your use of comparators and repeaters, even though they’re not quite as bad as redstone dust.
How do I make them?
Both clocks require two command blocks as a base. One to set the redstone blocks, the other to set the regular block.
setblock clock is slightly simpler than it’s larger cousin. It creates and destroys a single redstone block between the two command blocks.
Place two command blocks in a line, with a single free space in between. Remember what I said about the well-ordered execution earlier? This is based on the (relative) coordinates the command blocks are placed in, so let’s find out!
Press F3 to enter the debug screen. If you are playing on 1.8+ and the gamerule
reducedDebugInfo is false (the default), your cursor turns into a red green and blue thingy. This tells you the direction of the three major coordinate axes. Red points towards positive X, Green towards positive Y and Blue towards positive Z, that is RGB corresponds to XYZ.
No matter how you oriented your command blocks, locate the one at the lower coordinate and set it to
/setblock ~1 ~ ~ stone
In the other one, put
/setblock ~-1 ~ ~ redstone_block
This example is for the X-axis, for another axis, move the
~-1 to the corresponding position in the setblock command, e.g.
~ ~ ~1/
~-1 for the Z-axis. I used smoothstone as my alternate block, but you can use any other solid, non-transparent block (transparent blocks, including air blocks, would cause lighting updates!).
Place a redstone block in the center to jump-start the clock. If everything is done correctly, this block is immediately recreated when you break it.
You can now place up to 4 other command blocks next to the redstone block. Command blocks on the same axis activate from lower to higher coordinate. The execution order can be more difficult when working on different axes at the same time though. If more than two of your commands require to be run in a specific order, I suggest using a fill clock instead.
fill clock uses the same basic principles as the
setblock clock, but allows for more commands to be run by creating a line of redstone blocks rather than a single block.
Instead of the commands above, use (again, command blocks along the X-axis)
/fill ~1 ~ ~ ~1 ~ ~4 stone /fill ~-1 ~ ~ ~-1 ~ ~4 redstone_block
This creates a 1 block wide, 5 block long line of redstone blocks along the z-axis. The length is determined by the second set of coordinates.
Place your other commands along this line. The activation order will be along this line: At every redstone block the command block at the lower coordinate will be executed first. Afterwards, this continues at the next redstone block in the line.
Wait, what? How does that work?
The way this works is that at the beginning of every game tick, the game sees a newly created redstone block next to the command blocks, and starts to execute the commands. It always starts at the lower coordinate, so it replaces the redstone block with stone. Directly afterwards, the second command is executed. While the command block is technically not powered at the moment, it was triggered and runs, immediately re-replacing the stone with a redstone block. Rinse and repeat 20 times a second.
Source : Link , Question Author : MrLemon , Answer Author : Community