From a7674c52e6e3fdf1c14e04414be3c8196e3156b5 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 23 Aug 2017 10:42:07 +0100 Subject: [PATCH] Micro optimization to movement update checking No need to keep abs()ing this, because next time we have a movement update, motion < 0.00001 will be flattened to zero anyway. --- src/pocketmine/entity/Entity.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index a6afc6e1cb..b46306364d 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1322,9 +1322,9 @@ abstract class Entity extends Location implements Metadatable{ final public function hasMovementUpdate() : bool{ return ( $this->forceMovementUpdate or - abs($this->motionX) > self::MOTION_THRESHOLD or - abs($this->motionY) > self::MOTION_THRESHOLD or - abs($this->motionZ) > self::MOTION_THRESHOLD or + $this->motionX != 0 or + $this->motionY != 0 or + $this->motionZ != 0 or !$this->onGround ); }