World: do not hardcode length of day in computeSunAnglePercentage()

This commit is contained in:
Dylan K. Taylor 2022-05-16 18:17:32 +01:00
parent 4dbac79e86
commit 8b1bd5b7ff
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -1273,7 +1273,7 @@ class World implements ChunkManager{
* get an angle in radians, or by 360 to get an angle in degrees.
*/
public function computeSunAnglePercentage() : float{
$timeProgress = ($this->time % 24000) / 24000;
$timeProgress = ($this->time % self::TIME_FULL) / self::TIME_FULL;
//0.0 needs to be high noon, not dusk
$sunProgress = $timeProgress + ($timeProgress < 0.25 ? 0.75 : -0.25);