mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
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:
parent
0ff0b33047
commit
c2d0605b1e
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user