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

Non-Integer Time Cycle Durations Truncate The Decimal (and convert to integers) #2

Closed KxttyKxt closed 1 month ago

KxttyKxt commented 3 months ago

Minecraft Version: 1.21 Fabric Version: 0.5.11 Custom Time Cycle Version: 1.0.2-1.21

When setting a custom day/night duration, if the factor used is not a whole number, the fraction value is dropped.

For example, using a factor of 1.5x (/timecycle set 18000 18000), /timecycle status says that the day and night are each 15:00, but then follows up with Incrementing 1 time ticks every 1 server ticks. I have timed this, and I can confirm that day and night are still ten minutes. It should be incrementing 2 time ticks every 3 server ticks.

For another example, if I set the duration anywhere between 24001 and 35999, (~2.0001 - 2.999 times slower), it will only double the day and night cycle. Even making the days and nights twice as fast, if you try anywhere between 2x faster and 1x fast, it will round down to 1x speed.

My guess is that, somewhere, an integer was used where a double or float would be more appropriate. That said, I have not modded minecraft before, so your expertise is higher than mine. Below are some screenshots.

image image image image

eclipseisoffline commented 3 months ago

Hi and thank you for your report! This is indeed an oversight I made while creating this mod. Apologies! Fixing this shouldn't require a huge change, as I'll simply have to change the logic for calculating the time tick increment rate a bit. I'll try to fix it during the weekend!

eclipseisoffline commented 1 month ago

Hi, sorry for the late reply! This has been fixed in the latest release (version 0.1.3-1.21.1). The issue was a bit more complicated than I thought, and I ended up fixing it by implementing a floating-point day time counter, which allows for a floating-point increment value. Hopefully this should fix your issue, do let me know if you still encounter something though!

Apologies for the late fix again, I went on a trip and there were some other real life issues going on meaning I had less time available for programming.

KxttyKxt commented 1 month ago

Thank you!! I'll test it out as soon as I get the chance. (Though it could be awhile since the college semester started last week.)