Class AbstractAISkeleton<J extends IJob<?>>
java.lang.Object
com.minecolonies.core.entity.ai.workers.AbstractAISkeleton<J>
- Type Parameters:
J- the job this ai will have.
- All Implemented Interfaces:
ITickingStateAI
- Direct Known Subclasses:
AbstractEntityAIBasic
public abstract class AbstractAISkeleton<J extends IJob<?>>
extends Object
implements ITickingStateAI
Skeleton class for worker ai. Here general target execution will be handled. No utility on this level!
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Jprotected final @NotNull AbstractEntityCitizenprotected final net.minecraft.world.level.Level -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAISkeleton(J job) Sets up some important skeleton stuff for every ai. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the AI is allowed to be interruptedfinal IAIStategetState()Get the current state the ai is in.Get the statemachine of the AIintGets the update rate of the worker's statemachineprotected voidvoidOn removal of the AI.voidregisterGroupTarget(List<IAIState> states, TickingTransition<IAIState> target) Register a target for a group of statesvoidregisterTarget(TickingTransition<IAIState> target) Register one target.protected final voidregisterTargets(TickingTransition<IAIState>... targets) Register all targets your ai needs.voidresetAI()Resets the worker AI to Idle state, use with care interrupts all current ActionsvoidsetCurrentDelay(int ticksToNextUpdate) Sets the delay to next execution for the currently executed transitionvoidtick()Ticks the ai
-
Field Details
-
job
-
worker
-
world
protected final net.minecraft.world.level.Level world
-
-
Constructor Details
-
AbstractAISkeleton
Sets up some important skeleton stuff for every ai.- Parameters:
job- the job class.
-
-
Method Details
-
tick
public void tick()Description copied from interface:ITickingStateAITicks the ai- Specified by:
tickin interfaceITickingStateAI
-
registerTarget
Register one target.- Parameters:
target- the target to register.
-
registerGroupTarget
Register a target for a group of states- Parameters:
target- the target to register.
-
registerTargets
Register all targets your ai needs. They will be checked in the order of registration, so sort them accordingly.- Parameters:
targets- a number of targets that need registration
-
onException
-
getState
Get the current state the ai is in.- Specified by:
getStatein interfaceITickingStateAI- Returns:
- The current IAIState.
-
getTickRate
public int getTickRate()Gets the update rate of the worker's statemachine- Returns:
- update rate
-
canBeInterrupted
public boolean canBeInterrupted()Whether the AI is allowed to be interrupted- Returns:
- true if can be interrupted
-
resetAI
public void resetAI()Resets the worker AI to Idle state, use with care interrupts all current Actions- Specified by:
resetAIin interfaceITickingStateAI
-
getStateAI
Description copied from interface:ITickingStateAIGet the statemachine of the AI- Specified by:
getStateAIin interfaceITickingStateAI- Returns:
- statemachine
-
onRemoval
public void onRemoval()On removal of the AI. Clean up equipment.- Specified by:
onRemovalin interfaceITickingStateAI
-
setCurrentDelay
public void setCurrentDelay(int ticksToNextUpdate) Sets the delay to next execution for the currently executed transition- Parameters:
ticksToNextUpdate-
-