Class EntityAICavalry

All Implemented Interfaces:
ITickingStateAI

public class EntityAICavalry extends AbstractEntityAIGuard<JobCavalry,AbstractBuildingGuards>
Cavalry AI
  • Field Details

    • targetMount

      protected CavalryHorseEntity targetMount
    • stablePos

      protected net.minecraft.core.BlockPos stablePos
    • stableChecked

      protected boolean stableChecked
  • Constructor Details

    • EntityAICavalry

      public EntityAICavalry(@NotNull @NotNull JobCavalry job)
  • Method Details

    • decide

      protected IAIState decide()
      Decides the AI state the citizen should be in, and transitions as necessary. If the guard isn't mounted, will transition to the mount finding state. Otherwise, will call the super decide method.
      Overrides:
      decide in class AbstractEntityAIGuard<JobCavalry,AbstractBuildingGuards>
      Returns:
      the next AI state.
    • sleep

      protected IAIState sleep()
      Sleep activity If the guard is mounted, dismounts and clears the horse of the guard's reservation.
      Overrides:
      sleep in class AbstractEntityAIGuard<JobCavalry,AbstractBuildingGuards>
      Returns:
      the next state to go into
    • findStable

      protected IAIState findStable()
      Find a stable that might have available horses within range.
      Returns:
      the next AI state.
    • findMount

      protected IAIState findMount()
      Finds a horse to ride. If the horse is already assigned, ride it. Otherwise, find the closest horse and assign it to the guard. If no horse is found, return NO_TARGET. If the guard can't reach the horse, return FIND_MOUNT to try again.
      Returns:
      the next state to go to.
    • patrol

      public IAIState patrol()
      Patrol between a list of patrol points.
      Overrides:
      patrol in class AbstractEntityAIGuard<JobCavalry,AbstractBuildingGuards>
      Returns:
      the next patrol point to go to.
    • findNearestHorse

      @Nullable protected @Nullable CavalryHorseEntity findNearestHorse()
      Finds the nearest horse to the worker that is available for riding. If a horse is found that is reserved by the worker, it is prioritized over other available horses.
      Returns:
      the nearest available horse, or null if none are found
    • itemsNiceToHave

      @NotNull protected @NotNull List<ItemStorage> itemsNiceToHave()
      Adds a shield to the list of items that are nice to have if the shield usage research is enabled.
      Overrides:
      itemsNiceToHave in class AbstractEntityAIBasic<JobCavalry,AbstractBuildingGuards>
      Returns:
      the list of items nice to have.
    • canHelp

      public boolean canHelp(net.minecraft.core.BlockPos pos)
      Check if we can help a citizen
      Overrides:
      canHelp in class AbstractEntityAIGuard<JobCavalry,AbstractBuildingGuards>
      Parameters:
      pos -
      Returns:
      true if not fighting/helping already