Skip to content

StraightLineNavigator 5.46.0 ​

class · pocketmine\entity\ai\navigation\StraightLineNavigator · source

Extends PathNavigator

Navigation of flying and swimming mobs: they move in a straight line to the target (vanilla fish, bats, bees and allays mostly do too) with a \pocketmine\entity\ai\control\FlyingMoveControl or \pocketmine\entity\ai\control\SwimmingMoveControl. No path search is done, so it costs nothing; a mob that makes no progress for a while (blocked by a wall) gives up, and the goals pick another target.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $owner)

getPath() ​

php
public function getPath() : ?\pocketmine\entity\ai\navigation\Path

isDone() ​

php
public function isDone() : bool

moveTo() ​

php
public function moveTo(float $x, float $y, float $z, float $speedMultiplier, float $acceptDistance = 0.0) : bool

Moves to the given point (not the block: flying and swimming targets are positions, usually block centres).

moveToEntity() ​

php
public function moveToEntity(\pocketmine\entity\Entity $entity, float $speedMultiplier, float $acceptDistance = 1.0) : bool

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.