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.

Mappings:
Namespace Name
named net/minecraft/entity/ai/goal/GoalSelector
intermediary net/minecraft/class_1355
official caq
  • Field Details

    • REPLACEABLE_GOAL

      private static final PrioritizedGoal REPLACEABLE_GOAL
      Mappings:
      Namespace Name Mixin selector
      named REPLACEABLE_GOAL Lnet/minecraft/entity/ai/goal/GoalSelector;REPLACEABLE_GOAL:Lnet/minecraft/entity/ai/goal/PrioritizedGoal;
      intermediary field_18410 Lnet/minecraft/class_1355;field_18410:Lnet/minecraft/class_4135;
      official a Lcaq;a:Lccd;
    • goalsByControl

      private final Map<Goal.Control,PrioritizedGoal> goalsByControl
      Mappings:
      Namespace Name Mixin selector
      named goalsByControl Lnet/minecraft/entity/ai/goal/GoalSelector;goalsByControl:Ljava/util/Map;
      intermediary field_18411 Lnet/minecraft/class_1355;field_18411:Ljava/util/Map;
      official b Lcaq;b:Ljava/util/Map;
    • goals

      private final Set<PrioritizedGoal> goals
      Mappings:
      Namespace Name Mixin selector
      named goals Lnet/minecraft/entity/ai/goal/GoalSelector;goals:Ljava/util/Set;
      intermediary field_6461 Lnet/minecraft/class_1355;field_6461:Ljava/util/Set;
      official c Lcaq;c:Ljava/util/Set;
    • profiler

      private final Supplier<Profiler> profiler
      Mappings:
      Namespace Name Mixin selector
      named profiler Lnet/minecraft/entity/ai/goal/GoalSelector;profiler:Ljava/util/function/Supplier;
      intermediary field_6463 Lnet/minecraft/class_1355;field_6463:Ljava/util/function/Supplier;
      official d Lcaq;d:Ljava/util/function/Supplier;
    • disabledControls

      private final EnumSet<Goal.Control> disabledControls
      Mappings:
      Namespace Name Mixin selector
      named disabledControls Lnet/minecraft/entity/ai/goal/GoalSelector;disabledControls:Ljava/util/EnumSet;
      intermediary field_6462 Lnet/minecraft/class_1355;field_6462:Ljava/util/EnumSet;
      official e Lcaq;e:Ljava/util/EnumSet;
  • Constructor Details

    • GoalSelector

      public GoalSelector(Supplier<Profiler> profiler)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/entity/ai/goal/GoalSelector;<init>(Ljava/util/function/Supplier;)V
      intermediary <init> Lnet/minecraft/class_1355;<init>(Ljava/util/function/Supplier;)V
      official <init> Lcaq;<init>(Ljava/util/function/Supplier;)V
  • 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.
      Mappings:
      Namespace Name Mixin selector
      named add Lnet/minecraft/entity/ai/goal/GoalSelector;add(ILnet/minecraft/entity/ai/goal/Goal;)V
      intermediary method_6277 Lnet/minecraft/class_1355;method_6277(ILnet/minecraft/class_1352;)V
      official a Lcaq;a(ILcap;)V
    • clear

      public void clear(Predicate<Goal> predicate)
      Mappings:
      Namespace Name Mixin selector
      named clear Lnet/minecraft/entity/ai/goal/GoalSelector;clear(Ljava/util/function/Predicate;)V
      intermediary method_35113 Lnet/minecraft/class_1355;method_35113(Ljava/util/function/Predicate;)V
      official a Lcaq;a(Ljava/util/function/Predicate;)V
    • remove

      public void remove(Goal goal)
      Mappings:
      Namespace Name Mixin selector
      named remove Lnet/minecraft/entity/ai/goal/GoalSelector;remove(Lnet/minecraft/entity/ai/goal/Goal;)V
      intermediary method_6280 Lnet/minecraft/class_1355;method_6280(Lnet/minecraft/class_1352;)V
      official a Lcaq;a(Lcap;)V
    • usesAny

      private static boolean usesAny(PrioritizedGoal goal, EnumSet<Goal.Control> controls)
      Mappings:
      Namespace Name Mixin selector
      named usesAny Lnet/minecraft/entity/ai/goal/GoalSelector;usesAny(Lnet/minecraft/entity/ai/goal/PrioritizedGoal;Ljava/util/EnumSet;)Z
      intermediary method_38063 Lnet/minecraft/class_1355;method_38063(Lnet/minecraft/class_4135;Ljava/util/EnumSet;)Z
      official a Lcaq;a(Lccd;Ljava/util/EnumSet;)Z
    • canReplaceAll

      private static boolean canReplaceAll(PrioritizedGoal goal, Map<Goal.Control,PrioritizedGoal> goalsByControl)
      Mappings:
      Namespace Name Mixin selector
      named canReplaceAll Lnet/minecraft/entity/ai/goal/GoalSelector;canReplaceAll(Lnet/minecraft/entity/ai/goal/PrioritizedGoal;Ljava/util/Map;)Z
      intermediary method_38064 Lnet/minecraft/class_1355;method_38064(Lnet/minecraft/class_4135;Ljava/util/Map;)Z
      official a Lcaq;a(Lccd;Ljava/util/Map;)Z
    • tick

      public void tick()
      Mappings:
      Namespace Name Mixin selector
      named tick Lnet/minecraft/entity/ai/goal/GoalSelector;tick()V
      intermediary method_6275 Lnet/minecraft/class_1355;method_6275()V
      official a Lcaq;a()V
    • tickGoals

      public void tickGoals(boolean tickAll)
      Mappings:
      Namespace Name Mixin selector
      named tickGoals Lnet/minecraft/entity/ai/goal/GoalSelector;tickGoals(Z)V
      intermediary method_38849 Lnet/minecraft/class_1355;method_38849(Z)V
      official a Lcaq;a(Z)V
    • getGoals

      public Set<PrioritizedGoal> getGoals()
      Mappings:
      Namespace Name Mixin selector
      named getGoals Lnet/minecraft/entity/ai/goal/GoalSelector;getGoals()Ljava/util/Set;
      intermediary method_35115 Lnet/minecraft/class_1355;method_35115()Ljava/util/Set;
      official b Lcaq;b()Ljava/util/Set;
    • disableControl

      public void disableControl(Goal.Control control)
      Mappings:
      Namespace Name Mixin selector
      named disableControl Lnet/minecraft/entity/ai/goal/GoalSelector;disableControl(Lnet/minecraft/entity/ai/goal/Goal$Control;)V
      intermediary method_6274 Lnet/minecraft/class_1355;method_6274(Lnet/minecraft/class_1352$class_4134;)V
      official a Lcaq;a(Lcap$a;)V
    • enableControl

      public void enableControl(Goal.Control control)
      Mappings:
      Namespace Name Mixin selector
      named enableControl Lnet/minecraft/entity/ai/goal/GoalSelector;enableControl(Lnet/minecraft/entity/ai/goal/Goal$Control;)V
      intermediary method_6273 Lnet/minecraft/class_1355;method_6273(Lnet/minecraft/class_1352$class_4134;)V
      official b Lcaq;b(Lcap$a;)V
    • setControlEnabled

      public void setControlEnabled(Goal.Control control, boolean enabled)
      Mappings:
      Namespace Name Mixin selector
      named setControlEnabled Lnet/minecraft/entity/ai/goal/GoalSelector;setControlEnabled(Lnet/minecraft/entity/ai/goal/Goal$Control;Z)V
      intermediary method_6276 Lnet/minecraft/class_1355;method_6276(Lnet/minecraft/class_1352$class_4134;Z)V
      official a Lcaq;a(Lcap$a;Z)V