A Minecraft Data Pack library that lets you get the real life date & time ingame. For inquiries, please contact @silicatYT on Discord.
Download: Modrinth
Report bugs: GitHub
/tick freeze or singleplayer)TimeLib automatically keeps track of the date & time for you. For that to work, you first need to configure the settings to your personal taste. To access the settings, click the message that appears in chat after reloading, or manually run /function timelib:util/settings.
Command Block Offset: This is required to offset the time difference between the UTC timezone and your system time. If daylight savings change, this setting needs to be adjusted to ensure that the date calculation works properly.
Timezone Offset: Use this to change the displayed time.
The values for Year, Month, Day, Week Day, Hour, Minute, Second & the Unix Timestamp are all stored inside the player #TimeLib, with each value having its own scoreboard objective:
TimeLib.Year, TimeLib.Month, TimeLib.Day, TimeLib.WeekDay, TimeLib.Hour, TimeLib.Minute, TimeLib.Second & TimeLib.UnixTimeAdditionally, string versions (with leading 0s) of the date and daytime are stored in the timelib:date and timelib:daytime storages.
#timelib:date_changed: Function tag that gets executed whenever the date changes#timelib:daytime_changed: Function tag that gets executed whenever the daytime changes#timelib:game_unpaused: Function tag that gets executed whenever the game unpauses
#TimeLib TimeLib.PausedTicks scoreboard holds the number of ticks the game has been paused forThe tickrate updates once per second and can be read from the TimeLib.Tickrate scoreboard objective.
Note: The output date & time are in the UTC timezone, as daylight savings time cannot be properly accounted for.
#TimeLib.Input TimeLib.UnixTime score as the input./function timelib:util/unix_timestamp_to_date.#TimeLib.Output TimeLib.? scores, as well as the timelib:output data storage.minecraft.custom:minecraft:total_world_time scoreboard objective, which increments every tick even while the game is paused.Additional logic is used to ensure optimal results, good performance and accuracy.
From CMDred:
29999999 29999999 in the overworld, there may be collision.#TimeLib load.status: 1 if TimeLib is installed, otherwise unset#TimeLib.Version load.status: Release-specific number/function timelib:uninstall, then replace your current TimeLib version with the new one, then /reload to install the new version/function timelib:uninstallAs per the MIT License, you are allowed to redistribute, modify and use TimeLib as long as we are credited for the original work.