Instead of the dynamic nightcycle animation speed having hard-coded min- and max-values, this uses the night cycle animation speed specified in the config file as the minimum and twice that value as the maximum.
When the minimum required number of players (SleepService.getRequiredSleepersCount()) are sleeping, the speed starts off at the minimum.
For every additional sleeper, the speed increases. Up to the maximum (2x) when all players on the server are sleeping.
Example
nightcycle-animation-speed: 85players-required: 2
Sleeping
additionalPlayersRatio
calculatedSpeed
2/5
0.00
85
3/5
0.33
113
4/5
0.66
142
5/5
1.00
170
This new calculation has the nice side effect that enabling dynamic-animation-speed doesn't change anything, as long as only the minimum required number of players are sleeping.
In particular, when only one players is on the server and sleeping, the speed also stays at the minimum value.
Another possible improvement would be to make the factor for the maximum value configurable by the user, of course.
This changes two things:
SleepService.getRequiredSleepersCount()
) are sleeping, the speed starts off at the minimum.For every additional sleeper, the speed increases. Up to the maximum (2x) when all players on the server are sleeping.
Example
nightcycle-animation-speed
:85
players-required
:2
additionalPlayersRatio
calculatedSpeed
This new calculation has the nice side effect that enabling
dynamic-animation-speed
doesn't change anything, as long as only the minimum required number of players are sleeping. In particular, when only one players is on the server and sleeping, the speed also stays at the minimum value.Another possible improvement would be to make the factor for the maximum value configurable by the user, of course.