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 Details

    • job

      @NotNull protected final J extends IJob<?> job
    • worker

      @NotNull protected final @NotNull AbstractEntityCitizen worker
    • world

      protected final net.minecraft.server.level.ServerLevel world
  • Constructor Details

    • AbstractAISkeleton

      protected AbstractAISkeleton(@NotNull J job)
      Sets up some important skeleton stuff for every ai.
      Parameters:
      job - the job class.
  • Method Details

    • tick

      public void tick()
      Description copied from interface: ITickingStateAI
      Ticks the ai
      Specified by:
      tick in interface ITickingStateAI
    • registerTarget

      public void registerTarget(TickingTransition<IAIState> target)
      Register one target.
      Parameters:
      target - the target to register.
    • registerGroupTarget

      public void registerGroupTarget(List<IAIState> states, TickingTransition<IAIState> target)
      Register a target for a group of states
      Parameters:
      target - the target to register.
    • registerTargets

      protected final void registerTargets(TickingTransition<IAIState>... targets)
      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

      protected void onException(RuntimeException e)
    • getState

      public final IAIState getState()
      Get the current state the ai is in.
      Specified by:
      getState in interface ITickingStateAI
      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:
      resetAI in interface ITickingStateAI
    • getStateAI

      public ITickRateStateMachine<IAIState> getStateAI()
      Description copied from interface: ITickingStateAI
      Get the statemachine of the AI
      Specified by:
      getStateAI in interface ITickingStateAI
      Returns:
      statemachine
    • onRemoval

      public void onRemoval()
      On removal of the AI. Clean up equipment.
      Specified by:
      onRemoval in interface ITickingStateAI
    • setCurrentDelay

      public void setCurrentDelay(int ticksToNextUpdate)
      Sets the delay to next execution for the currently executed transition
      Parameters:
      ticksToNextUpdate -