Package net.minecraft.entity.ai.goal
Class GoalSelector
java.lang.Object
net.minecraft.entity.ai.goal.GoalSelector
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 cde
-
Field Summary
Modifier and TypeFieldDescriptionprivate final EnumSet
<Goal.Control> private final Set
<PrioritizedGoal> private final Map
<Goal.Control, PrioritizedGoal> private static final PrioritizedGoal
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a goal with a certain priority.private static boolean
canReplaceAll
(PrioritizedGoal goal, Map<Goal.Control, PrioritizedGoal> goalsByControl) void
void
disableControl
(Goal.Control control) void
enableControl
(Goal.Control control) getGoals()
void
void
setControlEnabled
(Goal.Control control, boolean enabled) void
tick()
void
tickGoals
(boolean tickAll) private static boolean
usesAny
(PrioritizedGoal goal, EnumSet<Goal.Control> controls)
-
Field Details
-
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
Lcde;a:Lcer;
-
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
Lcde;b:Ljava/util/Map;
-
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
Lcde;c:Ljava/util/Set;
-
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 d
Lcde;d:Ljava/util/EnumSet;
-
-
Constructor Details
-
GoalSelector
public GoalSelector()
-
-
Method Details
-
add
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
Lcde;a(ILcdd;)V
-
clear
- 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
Lcde;a(Ljava/util/function/Predicate;)V
-
remove
- 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
Lcde;a(Lcdd;)V
-
usesAny
- 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
Lcde;a(Lcer;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
Lcde;a(Lcer;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
Lcde;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
Lcde;a(Z)V
-
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
Lcde;b()Ljava/util/Set;
-
disableControl
- 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
Lcde;a(Lcdd$a;)V
-
enableControl
- 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
Lcde;b(Lcdd$a;)V
-
setControlEnabled
- 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
Lcde;a(Lcdd$a;Z)V
-