public class ConditionalTask<E extends LivingEntity> extends Task<E>
Task.Status
Modifier and Type | Field and Description |
---|---|
private boolean |
allowsContinuation |
private Predicate<E> |
condition |
private Task<? super E> |
delegate |
requiredMemoryStates
Constructor and Description |
---|
ConditionalTask(Map<MemoryModuleType<?>,MemoryModuleState> requiredMemoryStates,
Predicate<E> condition,
Task<? super E> delegate,
boolean allowsContinuation) |
ConditionalTask(Predicate<E> condition,
Task<? super E> delegate) |
Modifier and Type | Method and Description |
---|---|
protected void |
finishRunning(ServerWorld world,
E entity,
long time) |
protected boolean |
isTimeLimitExceeded(long time) |
protected void |
keepRunning(ServerWorld world,
E entity,
long time) |
private static Map<MemoryModuleType<?>,MemoryModuleState> |
merge(Map<MemoryModuleType<?>,MemoryModuleState> first,
Map<MemoryModuleType<?>,MemoryModuleState> second) |
protected void |
run(ServerWorld world,
E entity,
long time) |
protected boolean |
shouldKeepRunning(ServerWorld world,
E entity,
long time) |
protected boolean |
shouldRun(ServerWorld world,
E entity) |
String |
toString() |
getStatus, stop, tick, tryStarting
private final Predicate<E extends LivingEntity> condition
private final Task<? super E extends LivingEntity> delegate
private final boolean allowsContinuation
public ConditionalTask(Map<MemoryModuleType<?>,MemoryModuleState> requiredMemoryStates, Predicate<E> condition, Task<? super E> delegate, boolean allowsContinuation)
private static Map<MemoryModuleType<?>,MemoryModuleState> merge(Map<MemoryModuleType<?>,MemoryModuleState> first, Map<MemoryModuleType<?>,MemoryModuleState> second)
protected boolean shouldRun(ServerWorld world, E entity)
shouldRun
in class Task<E extends LivingEntity>
protected boolean shouldKeepRunning(ServerWorld world, E entity, long time)
shouldKeepRunning
in class Task<E extends LivingEntity>
protected boolean isTimeLimitExceeded(long time)
isTimeLimitExceeded
in class Task<E extends LivingEntity>
protected void run(ServerWorld world, E entity, long time)
run
in class Task<E extends LivingEntity>
protected void keepRunning(ServerWorld world, E entity, long time)
keepRunning
in class Task<E extends LivingEntity>
protected void finishRunning(ServerWorld world, E entity, long time)
finishRunning
in class Task<E extends LivingEntity>
public String toString()
toString
in class Task<E extends LivingEntity>