RFTools

RFTools

74M Downloads

Clock module is off by one hour.

brisingraerowing opened this issue ยท 11 comments

commented

I have a screen with a clock module, and when I did /time set 6000 (noon), the clock module displayed 11:00, not 12:00 as it should.

This is somewhat annoying, so could it be fixed?

RFTools Version: 5.26
Forge: 12.18.1.2094
MC: 1.10.2

commented

I can confirm that the clock is off. Was waiting for some proper testing to be sure and to characterise it better before filing a report, but since it seems to run at different speeds depending on the time of day, pretty sure there's an issue there.

commented

I just ported the algorithm used by this mod to calculate the time (and a related one from MC itself for the Celestial Angle) to C#, and got a correct answer from that code with a time value of 6000. I checked that I didn't make a mistake (it was a rather direct port), and found no issues. Why this mod has an issue is beyond me (MC Derp? Java math bug? Aliens?).

commented

For me, it's not off by an hour at 12:00. In fact, it is correct at noon and midnight. Between those times, it seems to first speed up and go too fast, then for the second half, it slows down, finally converging on 12:00 when it should. This is compared to the clock in InGameInfoXML. I didn't report it because it could have been that mod, and wanted to do more testing, but it does seem to change speeds, whereas the other mod ticks by at a constant rate, eyeballing it. At least that's what I recall. I'll observe it more today.

Right now, it says 13:48 and InGameInfoXML says 13:25, so I guess it's slow after noon. Assuming my perception as well as that mod is correct.

I blame aliens.

commented

Yes, must be aliens. No other explanation...

commented

If I do /time set 6000 I get 12:00
So I cannot reproduce this problem

commented

Some testing results:

Command Minecraft Time Clock Module Time
/time set 0 6:00 6:49
/time set 3000 9:00 9:41
/time set 6000 12:00 12:00
/time set 9000 15:00 14:18
/time set 12000 18:00 17:10
/time set 15000 21:00 20:28
/time set 18000 24:00 0:00
/time set 21000 3:00 3:32
/time set 24000 6:00 6:49

I believe the issue results from the fact that you are treating the in-game time as depending linearly on the celestial angle when in fact the celestial angle is not linear with respect to minecraft ticks. See https://github.com/SirCmpwn/TrueCraft/wiki/Sky although I can't guarantee this is still up-to-date.

InGameInfoXML calculates time correctly, see https://github.com/Lunatrius/InGame-Info-XML/blob/master/src/main/java/com/github/lunatrius/ingameinfo/tag/TagTime.java . I suspect the key to fixing this lies in using getWorldTime() rather than getCelestialAngle().

commented

That would certainly explain all of it, like the way it speeds up and slows down as the day goes by. I think you nailed it. Good job, Hjaldar!

commented

I will check and implement this soon. Thanks for all the extensive research

commented

Still not 100% how to fix but I'm investigating. The weird thing is that the vanilla clock item also uses getCelestialAngle like I do:

                    d0 = (double)worldIn.getCelestialAngle(1.0F);
commented

Ok, I got it. Fixed next release

commented

Thanks for the fix. Works great and a nice code refactor as well :)