Skip to content

AvoidEntityGoal 5.46.0 ​

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

Extends Goal

Runs away from nearby entities accepted by the filter (vanilla behavior.avoid_mob_type: fish from players, rabbits from wolves, villagers from zombies...): walks at $walkSpeed, and sprints at $sprintSpeed when the threat is within 7 blocks. Spectators and creative players are ignored.

Properties ​

$filter ​

php
public \Closure $filter

$maxDistance ​

php
public float $maxDistance

$mob ​

php
public \pocketmine\entity\Mob $mob

$sprintSpeed ​

php
public float $sprintSpeed

$walkSpeed ​

php
public float $walkSpeed

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, \Closure $filter, float $maxDistance, float $walkSpeed = 1.0, float $sprintSpeed = 1.0)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

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.