How to make a clock in Minecraft?
I want to create a clock that tells the player the current game time out of the 20 minutes in a day. I couldn't figure out any commands that did this, so I made a Redstone clock that activates every minute. But now I don't know how to separate the output.
If anyone could give me a command that does this, or a way to separate the output, it would help a lot. Thanks.
Best Answer
If you want to know the exact ingame time and show it somewhere, the /time
and /execute store
are your friend.
First we create a scoreboard to store the time and set some constants. Do the following in chat.
/scoreboard objectives add time dummy
/scoreboard players set $TickToHour time 1000
(This is so we divide the result of/time query daytime
to get current hour)- You can set more constants just like the above one for more time units (like seconds or minutes), but I will leave you to that. Here is a template:
/scoreboard players set $<var name> time <amount>
Then inside command blocks, pointing in a chain, in order, we will have:
execute store result score $time time run time query daytime
// this returns from 0 to 24000. 0 is sun rising, 6000 is sun above head, 12000 is sun setting.execute store result score $hour time run time query daytime
scoreboard players operation $hour time /= $TickToHour time
// this will devide it by 1000 returning 0->24. Basically time in hours.
Now if you want to show this value you can do in a bunch of different ways... But since you didn't specify how, I'll leave a idea/recomendation here:
/title @a actionbar {"score":{"name":"$time","objective":"time"},"color":"red"}
I don't particulary like constantly showing numbers above hotbar, but it works.
Pictures about "How to make a clock in Minecraft?"
How do u use a clock in Minecraft?
To make a redstone clock, place three blocks of any material in a square, with two blocks in between. Dig down one block in the spaces between the three blocks. Then, place the rest of your blocks in the holes and place torches on the original three blocks.Minecraft: How to make 5 redstone clocks
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Tara Winstead, Claudio Mota, Samira, Alexander Zvir