FollowMobGoal 5.47.0
Extends Goal
Follows the nearest other mob within the search range, stopping $stopDistance blocks away (vanilla behavior.follow_mob: wild parrots, ghastlings). By default it follows any visible mob of another kind (Java FollowMobGoal); a filter narrows it, and players can be preferred (Bedrock preferred_actor_type "player").
The search runs on goal evaluations, and waits a second after finding nothing to follow, so idle mobs don't query the world on every evaluation.
Properties
$filter
php
public ?\Closure $filter$includePlayers
php
public bool $includePlayers$mob
php
public \pocketmine\entity\Mob $mob$onlyWhen
php
public ?\Closure $onlyWhen$searchRange
php
public float $searchRange$speedMultiplier
php
public float $speedMultiplier$stopDistance
php
public float $stopDistanceMethods
__construct()
php
public function __construct(\pocketmine\entity\Mob $mob, float $speedMultiplier = 1.0, float $stopDistance = 3.0, float $searchRange = 20.0, ?\Closure $filter = null, bool $includePlayers = false, ?\Closure $onlyWhen = null)canContinue()
php
public function canContinue() : boolcanStart()
php
public function canStart() : boolgetFlags()
php
public function getFlags() : intgetFollowing()
php
public function getFollowing() : ?\pocketmine\entity\LivingReturns the mob being followed, if the goal is running.
start()
php
public function start() : voidstop()
php
public function stop() : voidtick()
php
public function tick() : void