Skip to content

FollowMobGoal 5.47.0 ​

class · pocketmine\entity\ai\goal\FollowMobGoal · source

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 $stopDistance

Methods ​

__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() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

getFollowing() ​

php
public function getFollowing() : ?\pocketmine\entity\Living

Returns the mob being followed, if the goal is running.

start() ​

php
public function start() : void

stop() ​

php
public function stop() : void

tick() ​

php
public function tick() : void

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.