Minecraft – way to keep a clock ticking with no players logged into SMP

minecraft-java-editionminecraft-redstone

I'm planning to build a clock tower for my SMP server; however, it's occurred to me that my plans have a gaping flaw: when nobody's online, the redstone clock won't keep time. I'm using vanilla, so Bukkit mods to keep chunks loaded won't work. Is it possible to use a different clock to count off hours, one that will keep running while I'm gone? Or better yet, somehow derive the time from the sun position?

Best Answer

The only solution I can think of is using a light sensor to manually correct the time displayed on the clock, but it would likely be very complicated, and depending on how the clock tower is built, it might not work. What you would do is build a light sensor and feed its output into a special reset line that sets the clock to a certain time. When the sun rises, it would activate the light sensor and set the clock to whatever time sunrise should be.

Ideally, you would also take the output of the clock, and give the clock a time range in which to ignore the light sensor, so that the clock wouldn't be changing times every morning (because the time at which the light sensor activates is slightly random). If, say, you wanted sunrise to set the clock to 7:30, you could create a signal that is turned on when the clock reads any time from 7:20-7:40, invert it, and connect it to one input of an AND gate (the other being the output of the light sensor). The output of this AND gate would be the signal to set the clock to 7:30. This way, if the light sensor activated and the time was already near 7:30, the clock would ignore it. (Now that I think about it, this would be a good way to implement error detection in the clock as well, in case the timing is slightly off).

Here's a video of a light sensor and how to build it: