diff --git a/src/entity/Entity.php b/src/entity/Entity.php index b02f877e3..c6fdc0c76 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1192,9 +1192,14 @@ abstract class Entity{ $this->boundingBox = $moveBB; } - $this->location->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2; - $this->location->y = $this->boundingBox->minY - $this->ySize; - $this->location->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2; + $this->location = new Location( + ($this->boundingBox->minX + $this->boundingBox->maxX) / 2, + $this->boundingBox->minY - $this->ySize, + ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2, + $this->location->yaw, + $this->location->pitch, + $this->location->world + ); $this->checkChunks(); $this->checkBlockCollision(); @@ -1301,9 +1306,12 @@ abstract class Entity{ } } - $this->location->x = $pos->x; - $this->location->y = $pos->y; - $this->location->z = $pos->z; + $this->location = Location::fromObject( + $pos, + $this->location->world, + $this->location->yaw, + $this->location->pitch + ); $this->recalculateBoundingBox(); diff --git a/src/entity/projectile/Projectile.php b/src/entity/projectile/Projectile.php index a6c0f810d..49d386578 100644 --- a/src/entity/projectile/Projectile.php +++ b/src/entity/projectile/Projectile.php @@ -219,9 +219,12 @@ abstract class Projectile extends Entity{ } } - $this->location->x = $end->x; - $this->location->y = $end->y; - $this->location->z = $end->z; + $this->location = Location::fromObject( + $end, + $this->location->world, + $this->location->yaw, + $this->location->pitch + ); $this->recalculateBoundingBox(); if($hitResult !== null){