GoalSelector 5.46.0
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) : voidcount()
php
public function count() : intgetRunningGoals()
php
public function getRunningGoals() : arrayisRunning()
php
public function isRunning(\pocketmine\entity\ai\goal\Goal $goal) : boolremoveGoal()
php
public function removeGoal(\pocketmine\entity\ai\goal\Goal $goal) : voidsetFlagDisabled()
php
public function setFlagDisabled(int $flag, bool $disabled) : voidstopAll()
php
public function stopAll() : voidStops all running goals.
tick()
php
public function tick(bool $evaluate = true) : void