Entity: add addMotion() to allow updating motion vector

this allows updating motion without needing to create new objects for the task.
This commit is contained in:
Dylan K. Taylor 2019-01-27 15:43:57 +00:00
parent bccc07633c
commit ac551cf248

View File

@ -1680,6 +1680,19 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
return true; return true;
} }
/**
* Adds the given values to the entity's motion vector.
*
* @param float $x
* @param float $y
* @param float $z
*/
public function addMotion(float $x, float $y, float $z) : void{
$this->motion->x += $x;
$this->motion->y += $y;
$this->motion->z += $z;
}
public function isOnGround() : bool{ public function isOnGround() : bool{
return $this->onGround; return $this->onGround;
} }