diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 477d78f21..3b37e87f7 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1175,8 +1175,8 @@ abstract class Entity extends Location implements Metadatable{ */ public function teleport(Vector3 $pos, $yaw = null, $pitch = null){ if($pos instanceof Location){ - $yaw = $pos->yaw; - $pitch = $pos->pitch; + $yaw = $yaw === null ? $pos->yaw : $yaw; + $pitch = $pitch === null ? $pos->pitch : $pitch; } $from = Position::fromObject($this, $this->level); $to = Position::fromObject($pos, $pos instanceof Position ? $pos->getLevel() : $this->level); @@ -1192,6 +1192,17 @@ abstract class Entity extends Location implements Metadatable{ $this->fallDistance = 0; $this->onGround = true; + $this->lastX = $this->x; + $this->lastY = $this->y; + $this->lastZ = $this->z; + + $this->lastYaw = $this->yaw; + $this->lastPitch = $this->pitch; + + foreach($this->hasSpawned as $player){ + $player->addEntityMovement($this->getId(), $this->x, $this->y, $this->z, $this->yaw, $this->pitch); + } + return true; }