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 awy
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 Lawy;a:Lorg/apache/logging/log4j/Logger;
      intermediary field_6466 Lnet/minecraft/class_1355;field_6466:Lorg/apache/logging/log4j/Logger;
      named LOGGER Lnet/minecraft/entity/ai/goal/GoalSelector;LOGGER:Lorg/apache/logging/log4j/Logger;
    • REPLACEABLE_GOAL

      private static final PrioritizedGoal REPLACEABLE_GOAL
      Mappings:
      Namespace Name Mixin selector
      official b Lawy;b:Layn;
      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 Lawy;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 Lawy;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 Lawy;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 Lawy;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;
    • timeInterval

      private int timeInterval
      Mappings:
      Namespace Name Mixin selector
      official g Lawy;g: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> Lawy;<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 Lawy;a(ILawx;)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
    • remove

      public void remove​(Goal goal)
      Mappings:
      Namespace Name Mixin selector
      official a Lawy;a(Lawx;)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
    • tick

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

      public Stream<PrioritizedGoal> getRunningGoals()
      Mappings:
      Namespace Name Mixin selector
      official d Lawy;d()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;
    • disableControl

      public void disableControl​(Goal.Control control)
      Mappings:
      Namespace Name Mixin selector
      official a Lawy;a(Lawx$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 Lawy;b(Lawx$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 Lawy;a(Lawx$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