Converting Current World Time variable to regular time (RL) display

Started by ninjawizard1234 on

Topic category: Help with modding (Java Edition)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Converting Current World Time variable to regular time (RL) display

hey guys, so im Returning the number var 'Current World Time' to my overlay, to display like a clock of the time, but it display like when you set on commands /time set 0 for example, is there a formula to convert that to rl time ? like to Display 6:00 when time = 0 ? i would do it but i cant find referencials like, wthat is the value when time is 12:00 (midday) for example? thanks in advance

Last seen on 08:39, 23. Jan 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In Minecraft, the in-game…
Tue, 01/23/2024 - 08:40

In Minecraft, the in-game time is measured in ticks, and a full day-night cycle is 24000 ticks. To convert this to real time, you can use the following formula:

Real Time = (Minecraft Time * Length of a Day) / Total Ticks in a Day

For example, if you want to display 6:00 when the in-game time is 0, and assuming a day in Minecraft is 20 minutes (24000 ticks), the calculation would be:

Real Time = (Minecraft Time * 24) / 24000

Keep in mind that the length of a day in Minecraft can be modified by the server or in the game settings, so you may need to adjust the formula accordingly.

As for the value when time is 12:00 (midday), it would be when the in-game time is around 6000 (a quarter of the day).

contexto