Minecraft Data Packs / Other

real time in minecraft

  • check_circle Functions
  • 1,925 views, 9 today
  • 153 downloads, 0 today
  • 4
  • 4
  • 2
Funty's Avatar Funty
Level 14 : Journeyman Cake
1
I already made a datapack to display the real date in minecraft , so why not also the time.
This time a lot simpler because its uses nothing external.

It will display your time if you play in singe player.
If you play on a server, it will show the internal server time. This may be different to yours, depending on where you are located and where the server is located.



What make it better than others?

The idea is not original from me, so yes there are already other datapacks doing the same thing. But this datapack is more Lightweight than the ones I found.


Long form:
The datapacks I found uses a 32 MB big loot table and look for every possible commandblock output (this is where the time comes from) and then give the correct score. This Datapack separate the string before looking through, so I only have to check for 144 possible results. So I come to a file size of about 13 KB. (And I don't even use loot tables yet)



Functions

Display as actionbar title:
The datapack make it possible to display the time in the actionbar title. To toggle that you can use
/trigger displayActionbar
get time as string:
If you don't need the time necessary as a score or int, you should use the string. It will be saved in the data storage "rltime:time" there are three objects. "hour", "minute" and "second" each contains the string of the hour, minute or second.
/data get storage rltime:time <hour or minute or second>
get time as scoreboard score
If you need it as a score, you can get it from the "rltime" scoreboard. There are three players. "%hour", "%minute" and "%second" each has the hour, minute or second as score.
/scoreboard players get <%hour or %minute or %second> rltime To reduce unnecessary performance issues, you need to update it manually with
/function rltime:toscoreboard/<all or hour or minute or second>



Uninstall datapack
/function rltime:uninstallthis will remove everything the datapack did.
CompatibilityMinecraft 1.19
Tags

Create an account or sign in to comment.

Seb_Semos
09/16/2023 2:11 pm
Level 43 : Master Miner
Seb_Semos's Avatar
Hi. This is great. I wanted time to display on my server. They have a "time" command in the console I can schedule, but it display the server time and I can't give correction, wich is honeslty a bit dumb.
So I'm gonna run your data pack, I just adjusted the values in the hour.mcfunction to correct and run a scheduled task to get a display of the time :)



I saw you can remove a line in there btw, the one that check for 24.
1
Profet
06/23/2023 1:20 am
Level 1 : New Miner
Profet's Avatar
woooooooooooooooooooooooooooooooo
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome