mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Entity: Added recalculateBoundingBox()
This commit is contained in:
parent
9551e5b8e5
commit
857b63ba8f
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user