PathNavigator 5.46.0
class · pocketmine\entity\ai\navigation\PathNavigator · source
Plans paths for a walking mob and feeds their waypoints to its \pocketmine\entity\ai\control\MoveControl.
Path searches are rationed by AiBudget: a request that doesn't get budget stays pending and is retried on the next ticks. Following a moving entity reuses the current path until the entity has moved away from its end, and failed searches to the same block are not retried for a while.
Methods
__construct()
php
public function __construct(\pocketmine\entity\Mob $mob, int $maxDrop = 3, bool $canSwim = true, bool $avoidWater = false)getPath()
php
public function getPath() : ?\pocketmine\entity\ai\navigation\PathgetPathFinder()
php
public function getPathFinder() : \pocketmine\entity\ai\navigation\PathFinderisDone()
php
public function isDone() : boolWhether the navigator has nothing to do (no path being followed and no search pending).
moveTo()
php
public function moveTo(float $x, float $y, float $z, float $speedMultiplier, float $acceptDistance = 0.0) : boolRequests a path to the given position. Returns false if a recent search to the same block failed.
moveToEntity()
php
public function moveToEntity(\pocketmine\entity\Entity $entity, float $speedMultiplier, float $acceptDistance = 1.0) : boolRequests a path to an entity, repathing when it moves away from the end of the current path.
setSpeedMultiplier()
php
public function setSpeedMultiplier(float $speedMultiplier) : voidstop()
php
public function stop() : voidtick()
php
public function tick() : void