Package net.minecraft.entity.ai.brain
Class Brain<E extends LivingEntity>
java.lang.Object
net.minecraft.entity.ai.brain.Brain<E>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Brain.BrainCodec<E extends LivingEntity>
(package private) static final class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Map<Activity,
Set<MemoryModuleType<?>>> private final Map<Activity,
Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>, MemoryModuleStatus>>> private Activity
private long
private static final org.apache.logging.log4j.Logger
private final Map<MemoryModuleType<?>,
Optional<? extends Memory<?>>> private Schedule
-
Constructor Summary
ConstructorDescriptionBrain
(Collection<? extends MemoryModuleType<?>> p_i231494_1_, Collection<? extends SensorType<? extends Sensor<? super E>>> p_i231494_2_, com.google.common.collect.ImmutableList<Brain.MemoryCodec<?>> p_i231494_3_, Supplier<com.mojang.serialization.Codec<Brain<E>>> p_i231494_4_) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
activityRequirementsAreMet
(Activity p_218217_1_) void
addActivity
(Activity p_233698_1_, int p_233698_2_, com.google.common.collect.ImmutableList<? extends Task<? super E>> p_233698_3_) void
addActivity
(Activity p_218208_1_, com.google.common.collect.ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer, ? extends Task<? super E>>> p_218208_2_) private void
addActivityAndRemoveMemoriesWhenStopped
(Activity p_233701_1_, com.google.common.collect.ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer, ? extends Task<? super E>>> p_233701_2_, Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>, MemoryModuleStatus>> p_233701_3_, Set<MemoryModuleType<?>> p_233701_4_) void
addActivityAndRemoveMemoryWhenStopped
(Activity p_233699_1_, int p_233699_2_, com.google.common.collect.ImmutableList<? extends Task<? super E>> p_233699_3_, MemoryModuleType<?> p_233699_4_) void
addActivityWithConditions
(Activity p_233700_1_, com.google.common.collect.ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer, ? extends Task<? super E>>> p_233700_2_, Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>, MemoryModuleStatus>> p_233700_3_) boolean
checkMemory
(MemoryModuleType<?> p_218196_1_, MemoryModuleStatus p_218196_2_) static <E extends LivingEntity>
com.mojang.serialization.Codec<Brain<E>>codec
(Collection<? extends MemoryModuleType<?>> p_233710_0_, Collection<? extends SensorType<? extends Sensor<? super E>>> p_233710_1_) (package private) com.google.common.collect.ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,
? extends Task<? super E>>> createPriorityPairs
(int p_233692_1_, com.google.common.collect.ImmutableList<? extends Task<? super E>> p_233692_2_) private void
eraseMemoriesForOtherActivitesThan
(Activity p_233715_1_) <U> void
eraseMemory
(MemoryModuleType<U> p_218189_1_) private void
<U> Optional<U>
getMemory
(MemoryModuleType<U> p_218207_1_) Deprecated.boolean
hasMemoryValue
(MemoryModuleType<?> p_218191_1_) boolean
private boolean
isEmptyCollection
(Object p_218213_1_) <U> boolean
isMemoryValue
(MemoryModuleType<U> p_233708_1_, U p_233708_2_) private Stream<Brain.MemoryCodec<?>>
memories()
static <E extends LivingEntity>
Brain.BrainCodec<E>provider
(Collection<? extends MemoryModuleType<?>> p_233705_0_, Collection<? extends SensorType<? extends Sensor<? super E>>> p_233705_1_) <T> com.mojang.serialization.DataResult<T>
serializeStart
(com.mojang.serialization.DynamicOps<T> p_233702_1_) private void
setActiveActivity
(Activity p_233713_1_) void
setActiveActivityIfPossible
(Activity p_218202_1_) void
setActiveActivityToFirstValid
(List<Activity> p_233706_1_) void
setCoreActivities
(Set<Activity> p_218199_1_) void
setDefaultActivity
(Activity p_218200_1_) <U> void
setMemory
(MemoryModuleType<U> p_218226_1_, Optional<? extends U> p_218226_2_) <U> void
setMemory
(MemoryModuleType<U> p_218205_1_, U p_218205_2_) private <U> void
setMemoryInternal
(MemoryModuleType<U> p_233709_1_, Optional<? extends Memory<?>> p_233709_2_) <U> void
setMemoryWithExpiry
(MemoryModuleType<U> p_233696_1_, U p_233696_2_, long p_233696_3_) void
setSchedule
(Schedule p_218203_1_) private void
startEachNonRunningBehavior
(ServerWorld p_218218_1_, E p_218218_2_) void
stopAll
(ServerWorld p_218227_1_, E p_218227_2_) void
tick
(ServerWorld p_218210_1_, E p_218210_2_) private void
tickEachRunningBehavior
(ServerWorld p_218222_1_, E p_218222_2_) private void
tickSensors
(ServerWorld p_233711_1_, E p_233711_2_) void
updateActivityFromSchedule
(long p_218211_1_, long p_218211_3_) void
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
codec
-
memories
-
sensors
private final Map<SensorType<? extends Sensor<? super E extends LivingEntity>>,Sensor<? super E extends LivingEntity>> sensors -
availableBehaviorsByPriority
-
schedule
-
activityRequirements
private final Map<Activity,Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>, activityRequirementsMemoryModuleStatus>>> -
activityMemoriesToEraseWhenStopped
-
coreActivities
-
activeActivities
-
defaultActivity
-
lastScheduleUpdate
private long lastScheduleUpdate
-
-
Constructor Details
-
Brain
public Brain(Collection<? extends MemoryModuleType<?>> p_i231494_1_, Collection<? extends SensorType<? extends Sensor<? super E>>> p_i231494_2_, com.google.common.collect.ImmutableList<Brain.MemoryCodec<?>> p_i231494_3_, Supplier<com.mojang.serialization.Codec<Brain<E>>> p_i231494_4_)
-
-
Method Details
-
provider
public static <E extends LivingEntity> Brain.BrainCodec<E> provider(Collection<? extends MemoryModuleType<?>> p_233705_0_, Collection<? extends SensorType<? extends Sensor<? super E>>> p_233705_1_) -
codec
public static <E extends LivingEntity> com.mojang.serialization.Codec<Brain<E>> codec(Collection<? extends MemoryModuleType<?>> p_233710_0_, Collection<? extends SensorType<? extends Sensor<? super E>>> p_233710_1_) -
serializeStart
public <T> com.mojang.serialization.DataResult<T> serializeStart(com.mojang.serialization.DynamicOps<T> p_233702_1_) -
memories
-
hasMemoryValue
-
eraseMemory
-
setMemory
-
setMemoryWithExpiry
public <U> void setMemoryWithExpiry(MemoryModuleType<U> p_233696_1_, U p_233696_2_, long p_233696_3_) -
setMemory
-
setMemoryInternal
private <U> void setMemoryInternal(MemoryModuleType<U> p_233709_1_, Optional<? extends Memory<?>> p_233709_2_) -
getMemory
-
isMemoryValue
-
checkMemory
-
getSchedule
-
setSchedule
-
setCoreActivities
-
getRunningBehaviors
Deprecated. -
useDefaultActivity
public void useDefaultActivity() -
getActiveNonCoreActivity
-
setActiveActivityIfPossible
-
setActiveActivity
-
eraseMemoriesForOtherActivitesThan
-
updateActivityFromSchedule
public void updateActivityFromSchedule(long p_218211_1_, long p_218211_3_) -
setActiveActivityToFirstValid
-
setDefaultActivity
-
addActivity
-
addActivityAndRemoveMemoryWhenStopped
public void addActivityAndRemoveMemoryWhenStopped(Activity p_233699_1_, int p_233699_2_, com.google.common.collect.ImmutableList<? extends Task<? super E>> p_233699_3_, MemoryModuleType<?> p_233699_4_) -
addActivity
-
addActivityWithConditions
public void addActivityWithConditions(Activity p_233700_1_, com.google.common.collect.ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer, ? extends Task<? super E>>> p_233700_2_, Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>, MemoryModuleStatus>> p_233700_3_) -
addActivityAndRemoveMemoriesWhenStopped
private void addActivityAndRemoveMemoriesWhenStopped(Activity p_233701_1_, com.google.common.collect.ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer, ? extends Task<? super E>>> p_233701_2_, Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>, MemoryModuleStatus>> p_233701_3_, Set<MemoryModuleType<?>> p_233701_4_) -
isActive
-
copyWithoutBehaviors
-
tick
-
tickSensors
-
forgetOutdatedMemories
private void forgetOutdatedMemories() -
stopAll
-
startEachNonRunningBehavior
-
tickEachRunningBehavior
-
activityRequirementsAreMet
-
isEmptyCollection
-
createPriorityPairs
-