mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Implement swimming/gliding including AABB recalculation (#4446)
- The following events have been added: - PlayerToggleGlideEvent - PlayerToggleSwimEvent - The following API methods have been added: - Entity->getSize() - Living->isSwimming() - Living->setSwimming() - Living->isGliding() - Living->setSwimming() - Player->toggleSwim() - Player->toggleGlide()
This commit is contained in:
@ -304,12 +304,8 @@ abstract class Entity{
|
||||
if($value <= 0){
|
||||
throw new \InvalidArgumentException("Scale must be greater than 0");
|
||||
}
|
||||
$this->size = $this->getInitialSizeInfo()->scale($value);
|
||||
|
||||
$this->scale = $value;
|
||||
|
||||
$this->recalculateBoundingBox();
|
||||
$this->networkPropertiesDirty = true;
|
||||
$this->setSize($this->getInitialSizeInfo()->scale($value));
|
||||
}
|
||||
|
||||
public function getBoundingBox() : AxisAlignedBB{
|
||||
@ -329,6 +325,16 @@ abstract class Entity{
|
||||
);
|
||||
}
|
||||
|
||||
public function getSize() : EntitySizeInfo{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
protected function setSize(EntitySizeInfo $size) : void{
|
||||
$this->size = $size;
|
||||
$this->recalculateBoundingBox();
|
||||
$this->networkPropertiesDirty = true;
|
||||
}
|
||||
|
||||
public function isImmobile() : bool{
|
||||
return $this->immobile;
|
||||
}
|
||||
|
Reference in New Issue
Block a user