How to setup a clock in 1.9?
Solution 1:
Without the use of redstone and block updates, it can become a bit complicated to replicate it. You will need to check the SuccessCount
value of the command block running the initial /testforblock
command to determine when the block is no longer there. Image setup:
-
The initial
/testforblock
command, checking for the stone button./testforblock -89 57 678 minecraft:stone_button 5
-
Conditional. If the
/testforblock
command succeeded, set the impulse command block (#5) to have anauto
tag value of 1, which causes it to run its command. Unlike a repeating command block, it will only run its command a single time.auto
has to be set back to 0 before it can activate again. Change "X Y Z" to the coordinates of the impulse block./blockdata X Y Z {auto:1b}
-
A secondary
/testforblock
that checks theSuccessCount
tag value of the repeating command block. If the value was 0, that means the stone button was not at the location, which means the impulse command block must haveauto
set back to 0./testforblock X Y Z minecraft:repeating_command_block -1 {SuccessCount:0}
-
Conditional. If the
SuccessCount
value was indeed 0, set the impulse block'sauto
tag value to 0./blockdata X Y Z {auto:0b}
-
This would be the command you want to run a single time when the stone button is at the location, but will be able to run a single time again if the stone button were to be removed and placed back down.
/say Test
The benefit of doing it this way is to reduce the number of block updates occur, as /blockdata
does not create block updates. The reduction is good for server performance.