From ac551cf2482420fa79b4b31b5b73380184b20e1a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 27 Jan 2019 15:43:57 +0000 Subject: [PATCH] Entity: add addMotion() to allow updating motion vector this allows updating motion without needing to create new objects for the task. --- src/pocketmine/entity/Entity.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 2069c97f7..015ae9f9b 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1680,6 +1680,19 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ 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{ return $this->onGround; }