Entity: avoid implicit float truncation in getDirection()

this didn't cause any bugs because of the way the function is written, but it might have in other circumstances.
This commit is contained in:
Dylan K. Taylor 2020-09-11 21:01:22 +01:00
parent 0ff0b33047
commit c2d0605b1e

View File

@ -80,6 +80,7 @@ use function count;
use function current;
use function deg2rad;
use function floor;
use function fmod;
use function get_class;
use function in_array;
use function is_a;
@ -1312,7 +1313,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
}
public function getDirection() : ?int{
$rotation = ($this->yaw - 90) % 360;
$rotation = fmod($this->yaw - 90, 360);
if($rotation < 0){
$rotation += 360.0;
}