mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 11:18:52 +00:00
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:
parent
bccc07633c
commit
ac551cf248
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user