FreeMoveControl 5.46.0
Steers a mob that moves freely in three dimensions (flying mobs, mobs swimming in water) straight towards a wanted position. Unlike MoveControl, it produces the full 3D motion of the mob: the current motion is blended towards the wanted velocity by an acceleration factor every tick, which gives the floaty movement of ghasts, vexes, phantoms and guardians. There is no pathfinding: the goals pick reachable points (vanilla flying and swimming mobs mostly move in straight lines too).
Methods
__construct()
php
public function __construct(\pocketmine\entity\Mob $mob, float $acceleration = 0.1, bool $faceMovement = true)computeMotion()
php
public function computeMotion(\pocketmine\math\Vector3 $motion, float $idleDrag = 0.91) : \pocketmine\math\Vector3Returns the mob's motion for this tick: the current motion steered towards the wanted position, or slowed down by $idleDrag when there is nowhere to go.
distanceSquaredToWanted()
php
public function distanceSquaredToWanted() : floatReturns the squared distance from the mob to the wanted position.
getWantedX()
php
public function getWantedX() : floatgetWantedY()
php
public function getWantedY() : floatgetWantedZ()
php
public function getWantedZ() : floathasWanted()
php
public function hasWanted() : boolsetAcceleration()
php
public function setAcceleration(float $acceleration) : voidsetWantedPosition()
php
public function setWantedPosition(float $x, float $y, float $z, float $speed) : voidstop()
php
public function stop() : void