Real-World Clock with Command Blocks – Minecraft 1.12

Time is an interesting concept. It’s something that we all deal with on a day-to-day basis; but what about keeping track of time in the good old game of punching trees and mining blocks? One of my favourite examples of keeping time in Minecraft is this awesome piece of engineering right here, using discrete redstone to create a functional clock that keeps time in-game. My approach isn’t nearly as impressive but has its core functionality simplified by using command blocks to drive a display similar to the ones that are used on CNB’s clock. Using command blocks in this setup also inspired me to have it keep time in the real world since it’s easy to make quick changes to the scoreboard values that are being monitored.

The front panel uses seven-segment displays which are named for their seven segments used to interpret numerals. Keeping track of which segments are supposed to be turned on for each number let’s you tell them what to do with command blocks. With that in mind, you can use what’s called a truth table to map out how each segment should behave based on the values that you need to assign them. Let’s start with the frame of the display. Putting redstone in this configuration lets you control each set of pistons to simulate turning on and off each of the segments. Now back on our table, let’s work bottom to top.

For segment D, you can see that there are three instances where the segment isn’t visible: numbers 1, 4, and 7. So, back on our frame, let’s set three command blocks right here. Each of these will extend this set of pistons during the numbers 1, 4, and 7 to simulate the segments being turned off. We’ll set up our scoreboards soon, but let’s go ahead and enter this command into our first block. This block will always test the objective “m1”, which I’ll use for the minute’s first digit, and will activate only when it’s equal to 1. Make sure to set each block as a repeating, always-active block; this way it’s always keeping track of the scoreboard and adapting itself to values in real time. Repeat the same process for each segment and keep layering them over and over until you finally reach the top. And now you have a single display. Make three more but with different scoreboard objectives for each. Finish it with your favourite block and you’re one step closer to a completed clock. Let’s set up our scoreboard’s now. I use the same names used in each of my displays: “m1” and “m10” for the minutes and “h1” and “h10” for the hours.

Now, we have to take care of what’s called the carryover. This is what tells the ten’s place segments when to take on their values The first three sets have the same format: when the one’s place reaches 10, set it to 0 and add 1 to the ten’s place; the last set resets all values back to 0 for a 24-hour clock or to 1 for a 12-hour clock.

The most important piece is the main control. Set it here and set these commands on each side. One side will keep track of ticks for the blinking colon and the other side will keep track of adding minutes. Two new objectives will finish the control. The colon will blink on and off every half-second and a minute will be added every 1200 ticks. Setting the value just under it will account for redstone delay. Place the colon in the center of the clock and add a command to track its state. After placing commands to make setting the clock a little easier, give it a nice finishing cover. Now you have a working clock. It’s a simple device using the simple works of art that are seven- segment displays. I hope that you enjoyed watching and you can download below for a more detailed view.

Write comment

  • (will not be published)