diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index b29292301..7927d5962 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -608,6 +608,17 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $this->width *= $multiplier; $this->height *= $multiplier; $this->eyeHeight *= $multiplier; + + $this->recalculateBoundingBox(); + + $this->setDataProperty(self::DATA_SCALE, self::DATA_TYPE_FLOAT, $value); + } + + public function getBoundingBox(){ + return $this->boundingBox; + } + + protected function recalculateBoundingBox() : void{ $halfWidth = $this->width / 2; $this->boundingBox->setBounds( @@ -618,15 +629,8 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $this->y + $this->height, $this->z + $halfWidth ); - - $this->setDataProperty(self::DATA_SCALE, self::DATA_TYPE_FLOAT, $value); } - public function getBoundingBox(){ - return $this->boundingBox; - } - - public function isSneaking() : bool{ return $this->getGenericFlag(self::DATA_FLAG_SNEAKING); } @@ -1717,8 +1721,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $this->y = $pos->y; $this->z = $pos->z; - $radius = $this->width / 2; - $this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius); + $this->recalculateBoundingBox(); $this->blocksAround = null;