Class AbstractEntityAIUsesFurnace<J extends AbstractJob<?,J>,B extends AbstractBuilding>

Type Parameters:
J - the job it is for.
All Implemented Interfaces:
ITickingStateAI
Direct Known Subclasses:
EntityAIWorkCook, EntityAIWorkSmelter

public abstract class AbstractEntityAIUsesFurnace<J extends AbstractJob<?,J>,B extends AbstractBuilding> extends AbstractEntityAISkill<J,B>
AI class for all workers which use a furnace and require fuel and a block to smelt in it.
  • Field Details

    • BASE_XP_GAIN

      protected static final double BASE_XP_GAIN
      Base xp gain for the basic xp.
      See Also:
  • Constructor Details

    • AbstractEntityAIUsesFurnace

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

    • extractFromFurnace

      protected abstract void extractFromFurnace(net.minecraft.world.level.block.entity.FurnaceBlockEntity furnace)
      Method called to extract things from the furnace after it has been reached already. Has to be overwritten by the exact class.
      Parameters:
      furnace - the furnace to retrieveSmeltableFromFurnace from.
    • isSmeltable

      protected abstract boolean isSmeltable(net.minecraft.world.item.ItemStack stack)
      Method called to detect if a certain stack is of the type we want to be put in the furnace.
      Parameters:
      stack - the stack to check.
      Returns:
      true if so.
    • reachedMaxToKeep

      protected boolean reachedMaxToKeep()
      If the worker reached his max amount.
      Returns:
      true if so.
    • getPositionOfOvenToRetrieveFrom

      protected net.minecraft.core.BlockPos getPositionOfOvenToRetrieveFrom()
      Get the furnace which has finished smeltables. For this check each furnace which has been registered to the building. Check if the furnace is turned off and has something in the result slot or check if the furnace has more than x results.
      Returns:
      the position of the furnace.
    • getPositionOfOvenToRetrieveFuelFrom

      protected net.minecraft.core.BlockPos getPositionOfOvenToRetrieveFuelFrom()
      Get the furnace which has used fuel. For this check each furnace which has been registered to the building. Check if the furnace has used fuel in the fuel slot.
      Returns:
      the position of the furnace.
    • startWorking

      public IAIState startWorking()
      Central method of the furnace user, he decides about what to do next from here. First check if any of the workers has important tasks to handle first. If not check if there is an oven with an item which has to be retrieved. If not check if fuel and smeltable are available and request if necessary and get into inventory. Then check if able to smelt already.
      Returns:
      the next state to go to.
    • requestSmeltable

      public abstract void requestSmeltable()
      Request the smeltable item to the building. Specific worker has to override this.
    • checkForAdditionalJobs

      protected IAIState checkForAdditionalJobs()
      Check for additional jobs to execute after the traditional furnace user jobs have been handled.
      Returns:
      the next IAIState to go to.
    • checkForImportantJobs

      protected IAIState checkForImportantJobs()
      Check for important jobs to execute before the traditional furnace user jobs are handled.
      Returns:
      the next IAIState to go to.
    • getActionsDoneUntilDumping

      protected int getActionsDoneUntilDumping()
      Specify that we dump inventory after every action.
      Overrides:
      getActionsDoneUntilDumping in class AbstractEntityAIBasic<J extends AbstractJob<?,J>,B extends AbstractBuilding>
      Returns:
      1 to indicate that we dump inventory after every action
      See Also:
    • getSmeltAbleClass

      protected abstract IRequestable getSmeltAbleClass()
      Smeltabel the worker requires. Each worker has to override this.
      Returns:
      the type of it.