Getter and setter for gravity (#5584)

closes #5525
This commit is contained in:
Armen Deroian 2023-02-21 10:01:22 -05:00 committed by GitHub
parent 871bd169a8
commit 59a04c971f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -803,6 +803,15 @@ abstract class Entity{
$this->server->broadcastPackets($this->hasSpawned, [SetActorMotionPacket::create($this->id, $this->getMotion())]);
}
public function getGravity() : float{
return $this->gravity;
}
public function setGravity(float $gravity) : void{
Utils::checkFloatNotInfOrNaN("gravity", $gravity);
$this->gravity = $gravity;
}
public function hasGravity() : bool{
return $this->gravityEnabled;
}