This can also be achieved using purely command blocks (because redstone is an evil lag-machine), ideally using 1.9's new command blocks.
First, set the gamerules commandBlockOutput
and doDaylightCycle
to false
to turn off command block spam and the natural daylight cycle. We'll also need an objective to store a timer.
/scoreboard objectives add TIMER dummy
1.9
Next, place one repeat command block and three chain command blocks in a line. Set the last two to "conditional" and put the following commands
/scoreboard players add #TIMER TIMER 1
/scoreboard players test #TIMER TIMER <X>
/time add <Y>
/scoreboard players set #TIMER TIMER 0
#TIMER
is a nonexistent player (the # makes the name illegal for real players) who counts ticks for us.
Replace <X>
and <Y>
with appropriate numbers. Time will advance at a rate of <Y>
/<X>
the normal speed. Try and use low numbers, or time will "stutter" because it's only advanced every <X>
ticks.
1.8
Emulating 1.9's conditional command blocks in 1.8 without using redstone is non-trivial (but doable). Hence using /scoreboard players test
won't work.
We can use /execute
instead, but that won't work on a non-existing player because those are not entities. We can use an invisible armorstand instead:
/summon ArmorStand ~ ~ ~ {CustomName:"#TIMER",Marker:1b,Invisible:1b}
Create a fill clock and place the following three commands:
/scoreboard players add @e[type=ArmorStand,name=#TIMER] TIMER 1
/execute @e[type=ArmorStand,name=#TIMER,score_TIMER=0] ~ ~ ~ /time add <Y>
/scoreboard players set @e[type=ArmorStand,name=#TIMER,score_TIMER_min=<X>] TIMER 0
As above, set <X>
and <Y>
accordingly.