public class Brain<E extends LivingEntity> extends Object implements DynamicSerializable
Modifier and Type | Field and Description |
---|---|
private long |
activityStartTime |
private Set<Activity> |
coreActivities |
private Activity |
defaultActivity |
private Map<Activity,Set<MemoryModuleType<?>>> |
forgettingActivityMemories
The map from activities to the memories to forget after the activity is
completed.
|
private Map<MemoryModuleType<?>,Optional<? extends Memory<?>>> |
memories |
private Set<Activity> |
possibleActivities |
private Map<Activity,Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>,MemoryModuleState>>> |
requiredActivityMemories |
private Schedule |
schedule |
private Map<SensorType<? extends Sensor<? super E>>,Sensor<? super E>> |
sensors |
private Map<Integer,Map<Activity,Set<Task<? super E>>>> |
tasks |
Constructor and Description |
---|
Brain(Collection<MemoryModuleType<?>> memoryTypes,
Collection<SensorType<? extends Sensor<? super E>>> collection,
com.mojang.datafixers.Dynamic<T> dynamic) |
Modifier and Type | Method and Description |
---|---|
private boolean |
canDoActivity(Activity activity) |
Brain<E> |
copy() |
<U> void |
forget(MemoryModuleType<U> type) |
Optional<Activity> |
getFirstPossibleNonCoreActivity() |
<U> Optional<U> |
getOptionalMemory(MemoryModuleType<U> type) |
Schedule |
getSchedule() |
boolean |
hasActivity(Activity activity) |
boolean |
hasMemoryModule(MemoryModuleType<?> type) |
(package private) ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> |
indexTaskList(int begin,
ImmutableList<? extends Task<? super E>> immutableList) |
private boolean |
isEmptyCollection(Object value) |
boolean |
isMemoryInState(MemoryModuleType<?> type,
MemoryModuleState state) |
void |
method_24526(Activity activity) |
private void |
method_24537(Activity activity) |
private void |
method_27073(ServerWorld serverWorld,
E e) |
List<Task<? super E>> |
method_27074()
Deprecated.
|
private void |
method_27075() |
private <T,U> void |
readMemory(MemoryModuleType<U> type,
com.mojang.datafixers.Dynamic<T> data) |
void |
refreshActivities(long timeOfDay,
long time) |
<U> void |
remember(MemoryModuleType<U> type,
Optional<? extends U> value) |
<U> void |
remember(MemoryModuleType<U> type,
U value) |
<U> void |
remember(MemoryModuleType<U> type,
U value,
long startTime) |
void |
resetPossibleActivities() |
private void |
resetPossibleActivities(Activity activity) |
void |
resetPossibleActivities(List<Activity> list) |
<T> T |
serialize(com.mojang.datafixers.types.DynamicOps<T> ops) |
void |
setCoreActivities(Set<Activity> coreActivities) |
void |
setDefaultActivity(Activity activity) |
private <U> void |
setMemory(MemoryModuleType<U> type,
Optional<? extends Memory<?>> memory) |
void |
setSchedule(Schedule schedule) |
void |
setTaskList(Activity activity,
ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexedTasks) |
void |
setTaskList(Activity activity,
ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexedTasks,
Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>,MemoryModuleState>> requiredMemories) |
private void |
setTaskList(Activity activity,
ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexedTasks,
Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>,MemoryModuleState>> requiredMemories,
Set<MemoryModuleType<?>> forgettingMemories) |
void |
setTaskList(Activity activity,
int int2,
ImmutableList<? extends Task<? super E>> immutableList) |
void |
setTaskList(Activity activity,
int int2,
ImmutableList<? extends Task<? super E>> tasks,
MemoryModuleType<?> memoryModuleType) |
private void |
startTasks(ServerWorld serverWorld,
E e) |
void |
stopAllTasks(ServerWorld serverWorld,
E e) |
void |
tick(ServerWorld serverWorld,
E entity) |
private void |
updateTasks(ServerWorld serverWorld,
E e) |
private final Map<MemoryModuleType<?>,Optional<? extends Memory<?>>> memories
private final Map<SensorType<? extends Sensor<? super E extends LivingEntity>>,Sensor<? super E extends LivingEntity>> sensors
private Schedule schedule
private final Map<Activity,Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>,MemoryModuleState>>> requiredActivityMemories
private final Map<Activity,Set<MemoryModuleType<?>>> forgettingActivityMemories
private Activity defaultActivity
private long activityStartTime
public Brain(Collection<MemoryModuleType<?>> memoryTypes, Collection<SensorType<? extends Sensor<? super E>>> collection, com.mojang.datafixers.Dynamic<T> dynamic)
public boolean hasMemoryModule(MemoryModuleType<?> type)
private <T,U> void readMemory(MemoryModuleType<U> type, com.mojang.datafixers.Dynamic<T> data)
public <U> void forget(MemoryModuleType<U> type)
public <U> void remember(MemoryModuleType<U> type, @Nullable U value)
public <U> void remember(MemoryModuleType<U> type, U value, long startTime)
public <U> void remember(MemoryModuleType<U> type, Optional<? extends U> value)
private <U> void setMemory(MemoryModuleType<U> type, Optional<? extends Memory<?>> memory)
public <U> Optional<U> getOptionalMemory(MemoryModuleType<U> type)
public boolean isMemoryInState(MemoryModuleType<?> type, MemoryModuleState state)
public Schedule getSchedule()
public void setSchedule(Schedule schedule)
@Deprecated public List<Task<? super E>> method_27074()
public void resetPossibleActivities()
public void method_24526(Activity activity)
private void resetPossibleActivities(Activity activity)
private void method_24537(Activity activity)
public void refreshActivities(long timeOfDay, long time)
public void setDefaultActivity(Activity activity)
public void setTaskList(Activity activity, int int2, ImmutableList<? extends Task<? super E>> immutableList)
public void setTaskList(Activity activity, int int2, ImmutableList<? extends Task<? super E>> tasks, MemoryModuleType<?> memoryModuleType)
public void setTaskList(Activity activity, ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexedTasks)
public void setTaskList(Activity activity, ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexedTasks, Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>,MemoryModuleState>> requiredMemories)
private void setTaskList(Activity activity, ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexedTasks, Set<com.mojang.datafixers.util.Pair<MemoryModuleType<?>,MemoryModuleState>> requiredMemories, Set<MemoryModuleType<?>> forgettingMemories)
public boolean hasActivity(Activity activity)
public void tick(ServerWorld serverWorld, E entity)
private void method_27073(ServerWorld serverWorld, E e)
private void method_27075()
public void stopAllTasks(ServerWorld serverWorld, E e)
public <T> T serialize(com.mojang.datafixers.types.DynamicOps<T> ops)
serialize
in interface DynamicSerializable
private void startTasks(ServerWorld serverWorld, E e)
private void updateTasks(ServerWorld serverWorld, E e)
private boolean canDoActivity(Activity activity)
private boolean isEmptyCollection(Object value)
ImmutableList<? extends com.mojang.datafixers.util.Pair<Integer,? extends Task<? super E>>> indexTaskList(int begin, ImmutableList<? extends Task<? super E>> immutableList)
begin
- The beginning of the index of tasks, exclusive