Skip to content

FreeWanderGoal 5.46.0 ​

class · pocketmine\entity\ai\hostile\goal\FreeWanderGoal · source

Extends Goal

Moves a flying or swimming mob to random points nearby from time to time (vanilla behavior.float_wander, random_swim, vex random move). Points are picked in the medium the mob moves in: open air for flyers, water for swimmers.

Constants ​

MEDIUM_AIR ​

php
public const MEDIUM_AIR = 0

MEDIUM_ANY ​

php
public const MEDIUM_ANY = 2

Anything that doesn't block movement (noclip vexes pick points inside blocks too).

MEDIUM_WATER ​

php
public const MEDIUM_WATER = 1

Properties ​

$anchor ​

php
public ?\Closure $anchor

$control ​

php
public \pocketmine\entity\ai\hostile\FreeMoveControl $control

$horizontalRange ​

php
public int $horizontalRange

$interval ​

php
public int $interval

$medium ​

php
public int $medium

$mob ​

php
public \pocketmine\entity\Mob $mob

$speed ​

php
public float $speed

$verticalRange ​

php
public int $verticalRange

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, \pocketmine\entity\ai\hostile\FreeMoveControl $control, float $speed, int $interval = 60, int $horizontalRange = 8, int $verticalRange = 4, int $medium = self::MEDIUM_AIR, ?\Closure $anchor = null)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

isLineClear() protected ​

php
protected function isLineClear(float $x, float $y, float $z) : bool

Returns whether the straight line from the mob to the point only crosses blocks of the mob's medium (sampled every block).

pickPoint() protected ​

php
protected function pickPoint() : ?\pocketmine\math\Vector3

start() ​

php
public function start() : void

stop() ​

php
public function stop() : void

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