Skip to content

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\Path

getPathFinder() ​

php
public function getPathFinder() : \pocketmine\entity\ai\navigation\PathFinder

isDone() ​

php
public function isDone() : bool

Whether 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) : bool

Requests 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) : bool

Requests a path to an entity, repathing when it moves away from the end of the current path.

setSpeedMultiplier() ​

php
public function setSpeedMultiplier(float $speedMultiplier) : void

stop() ​

php
public function stop() : void

tick() ​

php
public function tick() : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.