Class EntityAIWorkCook
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<JobCook,BuildingCook>
com.minecolonies.core.entity.ai.workers.service.EntityAIWorkCook
- All Implemented Interfaces:
ITickingStateAI
Cook AI class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe amount of food which should be served to the worker.Fields inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIUsesFurnace
BASE_XP_GAINFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IAIStateChecks if the cook has anything important to do before going to the default furnace user jobs.protected voidextractFromFurnace(net.minecraft.world.level.block.entity.FurnaceBlockEntity furnace) Very simple action, cook straightly extract it from the furnace.protected intSpecify that we dump inventory after every action.Can be overridden in implementations to return the exact building type the worker expects.protected IRequestableSmeltabel the worker requires.protected 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.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.AbstractEntityAIUsesFurnace
checkForAdditionalJobs, getPositionOfOvenToRetrieveFrom, getPositionOfOvenToRetrieveFuelFromMethods 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, 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
-
SATURATION_TO_SERVE
public static final int SATURATION_TO_SERVEThe amount of food which should be served to the worker.- See Also:
-
-
Constructor Details
-
EntityAIWorkCook
Constructor for the Cook. Defines the tasks the cook executes.- Parameters:
job- a cook job to use.
-
-
Method Details
-
getExpectedBuildingClass
Description copied from class:AbstractEntityAIBasicCan be overridden in implementations to return the exact building type the worker expects.- Specified by:
getExpectedBuildingClassin classAbstractEntityAIBasic<JobCook,BuildingCook> - Returns:
- the building type associated with this AI's worker.
-
extractFromFurnace
protected void extractFromFurnace(net.minecraft.world.level.block.entity.FurnaceBlockEntity furnace) Very simple action, cook straightly extract it from the furnace.- Specified by:
extractFromFurnacein classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Parameters:
furnace- the furnace to retrieve from.
-
startWorking
Description copied from class:AbstractEntityAIUsesFurnaceCentral 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.- Overrides:
startWorkingin classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Returns:
- the next state to go to.
-
isSmeltable
protected boolean isSmeltable(net.minecraft.world.item.ItemStack stack) Description copied from class:AbstractEntityAIUsesFurnaceMethod called to detect if a certain stack is of the type we want to be put in the furnace.- Specified by:
isSmeltablein classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Parameters:
stack- the stack to check.- Returns:
- true if so.
-
reachedMaxToKeep
protected boolean reachedMaxToKeep()Description copied from class:AbstractEntityAIUsesFurnaceIf the worker reached his max amount.- Overrides:
reachedMaxToKeepin classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Returns:
- true if so.
-
requestSmeltable
public void requestSmeltable()Description copied from class:AbstractEntityAIUsesFurnaceRequest the smeltable item to the building. Specific worker has to override this.- Specified by:
requestSmeltablein classAbstractEntityAIUsesFurnace<JobCook,BuildingCook>
-
checkForImportantJobs
Checks if the cook has anything important to do before going to the default furnace user jobs. First calculate the building range if not cached yet. Then check for citizens around the building. If no citizen around switch to default jobs. If citizens around check if food in inventory, if not, switch to gather job. If food in inventory switch to serve job.- Overrides:
checkForImportantJobsin classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Returns:
- the next IAIState to transfer to.
-
getActionsDoneUntilDumping
protected int getActionsDoneUntilDumping()Description copied from class:AbstractEntityAIUsesFurnaceSpecify that we dump inventory after every action.- Overrides:
getActionsDoneUntilDumpingin classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Returns:
- 1 to indicate that we dump inventory after every action
- See Also:
-
getSmeltAbleClass
Description copied from class:AbstractEntityAIUsesFurnaceSmeltabel the worker requires. Each worker has to override this.- Specified by:
getSmeltAbleClassin classAbstractEntityAIUsesFurnace<JobCook,BuildingCook> - Returns:
- the type of it.
-