Class GoalSelector

java.lang.Object
net.minecraft.entity.ai.goal.GoalSelector

public class GoalSelector
extends Object
Manages a set of goals, which are competing for certain controls on the mob. Multiple goals can run at the same time, so long as they are all using different controls.

A running goal will always be replaced with a goal with a lower priority, if such a goal exists, it's competing for the same control and its canStart() method returns true. (Note that some goals randomize this method.)

If two goals have the same priority and are competing for the same control, then one goal cannot replace the other if it's running. The goal selector tries to run goals in the order they were added.

  • Field Details

  • Constructor Details

  • Method Details

    • add

      public void add​(int priority, Goal goal)
      Adds a goal with a certain priority. Goals with lower priorities will replace running goals with a higher priority.
    • remove

      public void remove​(Goal goal)
    • tick

      public void tick()
    • getRunningGoals

      public Stream<PrioritizedGoal> getRunningGoals()
    • disableControl

      public void disableControl​(Goal.Control control)
    • enableControl

      public void enableControl​(Goal.Control control)
    • setControlEnabled

      public void setControlEnabled​(Goal.Control control, boolean enabled)