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
official bkz
intermediary net/minecraft/class_1355
named net/minecraft/entity/ai/goal/GoalSelector
  • Field Details

    • LOGGER

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      official a Lbkz;a:Lorg/slf4j/Logger;
      intermediary field_6466 Lnet/minecraft/class_1355;field_6466:Lorg/slf4j/Logger;
      named LOGGER Lnet/minecraft/entity/ai/goal/GoalSelector;LOGGER:Lorg/slf4j/Logger;
    • REPLACEABLE_GOAL

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

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

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

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

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

      private int field_30212
      Mappings:
      Namespace Name Mixin selector
      official g Lbkz;g:I
      intermediary field_30212 Lnet/minecraft/class_1355;field_30212:I
      named field_30212 Lnet/minecraft/entity/ai/goal/GoalSelector;field_30212:I
    • timeInterval

      private int timeInterval
      Mappings:
      Namespace Name Mixin selector
      official h Lbkz;h:I
      intermediary field_6464 Lnet/minecraft/class_1355;field_6464:I
      named timeInterval Lnet/minecraft/entity/ai/goal/GoalSelector;timeInterval:I
  • Constructor Details

    • GoalSelector

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

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

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

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

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

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

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

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

      public Stream<PrioritizedGoal> getRunningGoals()
      Mappings:
      Namespace Name Mixin selector
      official c Lbkz;c()Ljava/util/stream/Stream;
      intermediary method_19048 Lnet/minecraft/class_1355;method_19048()Ljava/util/stream/Stream;
      named getRunningGoals Lnet/minecraft/entity/ai/goal/GoalSelector;getRunningGoals()Ljava/util/stream/Stream;
    • setTimeInterval

      public void setTimeInterval(int timeInterval)
      Mappings:
      Namespace Name Mixin selector
      official a Lbkz;a(I)V
      intermediary method_35114 Lnet/minecraft/class_1355;method_35114(I)V
      named setTimeInterval Lnet/minecraft/entity/ai/goal/GoalSelector;setTimeInterval(I)V
    • disableControl

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

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

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