eclipseisoffline / customtimecycle

Custom Time Cycle is a mod that allows changing the duration of Minecraft days and nights using a simple command, without changing tick speed.
GNU Lesser General Public License v3.0
1 stars 1 forks source link

Don't reset day time / day counter #4

Closed verarr closed 1 week ago

verarr commented 1 week ago

Resetting time causes issues for parts of the game and other mods that depend on the time continuously increasing, such as:

The only problem I can see with this (please correct me if I missed something) might be loss of precision over time. However, integers up to 9,007,199,254,740,992 can be exactly represented (when applied to ticks, that equals to more than 375,299,968,947 in-game days)

Alternatively, implement a persistent day counter in TimeManager, keep the time resetting code but with an added increment to the day counter, then add the counted days to the in-game time when it's being set.

eclipseisoffline commented 1 week ago

Hi, thanks! This is obviously a bug, not sure why I put this in when I implemented floating-point time. I don't see any issues with the day-time not being reset after 24000 ticks, as that's vanilla behaviour, which this mod isn't supposed to change.

As GitHub reviews don't let me comment on lines outside of what you changed I'm putting this here, could you please remove the constant at line 121 as I don't think it's used anymore. Other than that this looks all good to me!

verarr commented 1 week ago

I've removed the unused constant. Thanks for taking time for this!

eclipseisoffline commented 1 week ago

Looks good to me! I'll merge it now, once 1.21.2 releases this'll be included, and I'll backport it to 1.21/1.21.1 too. Thanks again!