Skip to content

GoalSelector 5.46.0 ​

final class · pocketmine\entity\ai\goal\GoalSelector · source

Runs a set of prioritised goals (lower number = more important), giving each control flag (move, look, jump, target) to at most one running goal.

Starting goals is the expensive part (every candidate's canStart() is checked), so it only happens every GoalSelector::$evaluateInterval ticks; running goals are ticked every time.

Methods ​

__construct() ​

php
public function __construct(int $evaluateInterval = 2, int $offset = 0)

addGoal() ​

php
public function addGoal(int $priority, \pocketmine\entity\ai\goal\Goal $goal) : void

count() ​

php
public function count() : int

getRunningGoals() ​

php
public function getRunningGoals() : array

isRunning() ​

php
public function isRunning(\pocketmine\entity\ai\goal\Goal $goal) : bool

removeGoal() ​

php
public function removeGoal(\pocketmine\entity\ai\goal\Goal $goal) : void

setFlagDisabled() ​

php
public function setFlagDisabled(int $flag, bool $disabled) : void

stopAll() ​

php
public function stopAll() : void

Stops all running goals.

tick() ​

php
public function tick(bool $evaluate = true) : void

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