From 3c93a57397dfc95b6d4880d2e8d2cc4beafa10eb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 16 Feb 2019 17:01:19 +0000 Subject: [PATCH] Entity: add a hack to prevent client-side movement when entity is not moving this fixes #2227. --- src/pocketmine/entity/Entity.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 3cade37c1..89cd64db8 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1164,6 +1164,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ } protected function updateMovement(bool $teleport = false) : void{ + //TODO: hack for client-side AI interference: prevent client sided movement when motion is 0 + $this->setImmobile($this->motion->x == 0 and $this->motion->y == 0 and $this->motion->z == 0); + $diffPosition = ($this->x - $this->lastX) ** 2 + ($this->y - $this->lastY) ** 2 + ($this->z - $this->lastZ) ** 2; $diffRotation = ($this->yaw - $this->lastYaw) ** 2 + ($this->pitch - $this->lastPitch) ** 2;