Botania

Botania

133M Downloads

Teru Teru Bozu doesn't reset the rain time

QbDesu opened this issue ยท 1 comments

commented

I don't know if this is intended but changing the weather using the Teru Teru Bozu doesn't reset the rain time. This causes ridiculous fluctuations in the weather timing. If done at the beginning of a weather phase this can cause a way too long rain phase when changing to rain and a way too short clear phase when changing to clear weather. Changing the weather if is 1 sec away from changing it would just turn back in after 1 second.

To explain it a bit better:
the rain time is used for both clear and rainy weather. it counts down and whenever it reaches 0 it toggles between rainy weather and clear weather starts.
the next tick after the weather has been toggled the rain time is most likely set to a higher value again however the time is set to a much higher number when clear weather starts than when rain starts.

this.rand.nextInt(168000) + 12000 //for clear weather
this.rand.nextInt(12000) + 12000 //for rainy weather
//both hardcoded unfortunately D:

So if you want to actually change the weather to also use the right timing you can use a method like this after you change the weather:

public void resetRainTime(World w){
    w.getWorldInfo().setRainTime( w.rand.nextInt( w.getWorldInfo().isRaining() ? 12000 : 168000 ) + 12000 );
}

You can find the code for this in World#updateWeatherBody if you want to see for yourself. I didn't make this a PR because I don't know if it's intended but I guess it isn't.

commented

Fixed now, I guess.