Class AbstractEntityAIUsesFurnace<J extends AbstractJob<?,J>,B extends AbstractBuilding>
java.lang.Object
com.minecolonies.core.entity.ai.workers.AbstractAISkeleton<J>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic<J,B>
com.minecolonies.core.entity.ai.workers.AbstractEntityAISkill<J,B>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIUsesFurnace<J,B>
- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected static final doubleBase xp gain for the basic xp.Fields inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic
building, currentWorkingLocation, needsCurrently, NO_TOOL, REQUEST_DELAY, STANDARD_DELAY, WALK_DELAY, walkTo, workPosIndexFields inherited from class com.minecolonies.core.entity.ai.workers.AbstractAISkeleton
job, worker, world -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSets up some important skeleton stuff for every ai. -
Method Summary
Modifier and TypeMethodDescriptionprotected IAIStateCheck for additional jobs to execute after the traditional furnace user jobs have been handled.protected IAIStateCheck for important jobs to execute before the traditional furnace user jobs are handled.protected abstract voidextractFromFurnace(net.minecraft.world.level.block.entity.FurnaceBlockEntity furnace) Method called to extract things from the furnace after it has been reached already.protected intSpecify that we dump inventory after every action.protected net.minecraft.core.BlockPosGet the furnace which has finished smeltables.protected net.minecraft.core.BlockPosGet the furnace which has used fuel.protected abstract IRequestableSmeltabel the worker requires.protected abstract booleanisSmeltable(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.protected booleanIf the worker reached his max amount.abstract voidRequest the smeltable item to the building.Central method of the furnace user, he decides about what to do next from here.Methods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic
afterDump, afterRequestPickUp, cancelAsynchRequestForArmor, canGoIdle, checkAndTransferFromHut, checkForToolOrWeapon, checkForToolOrWeapon, checkForToolOrWeaponAsync, checkIfNeedsItem, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForTagExistOrCreateAsync, getBuildingToDump, getEffectiveSkillLevel, getExceptionTimer, getExpectedBuildingClass, getFakePlayer, getInventory, getInvertedEffectiveSkillLevel, getModuleForJob, getMostEfficientTool, getPrimarySkillLevel, getSecondarySkillLevel, getStateAfterPickUp, getTotalRequiredAmount, getWorkingPosition, getWorkingPosition, hasNotDelayed, holdEfficientTool, incrementActionsDone, incrementActionsDone, incrementActionsDoneAndDecSaturation, inventoryNeedsDump, isAfterDumpPickupAllowed, itemsNiceToHave, onException, resetActionsDone, retrieveToolInHut, retrieveToolInTileEntity, setDelay, takeItemStackFromProvider, updateRenderMetaData, waitForRequests, walkToBuilding, walkToBuilding, walkToSafePos, walkToTaggedWorkPos, walkToUnSafePos, walkToUnSafePos, walkToWorkPos, walkWithProxy, walkWithProxy, wantInventoryDumpedMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractAISkeleton
canBeInterrupted, getState, getStateAI, getTickRate, onRemoval, registerGroupTarget, registerTarget, registerTargets, resetAI, setCurrentDelay, tick
-
Field Details
-
BASE_XP_GAIN
protected static final double BASE_XP_GAINBase xp gain for the basic xp.- See Also:
-
-
Constructor Details
-
AbstractEntityAIUsesFurnace
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
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
Check for additional jobs to execute after the traditional furnace user jobs have been handled.- Returns:
- the next IAIState to go to.
-
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:
getActionsDoneUntilDumpingin classAbstractEntityAIBasic<J extends AbstractJob<?,J>, B extends AbstractBuilding> - Returns:
- 1 to indicate that we dump inventory after every action
- See Also:
-
getSmeltAbleClass
Smeltabel the worker requires. Each worker has to override this.- Returns:
- the type of it.
-