Class EntityAIWorkFarmer
java.lang.Object
com.minecolonies.core.entity.ai.workers.AbstractAISkeleton<JobFarmer>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic<JobFarmer,BuildingFarmer>
com.minecolonies.core.entity.ai.workers.AbstractEntityAISkill<JobFarmer,BuildingFarmer>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract<JobFarmer,BuildingFarmer>
com.minecolonies.core.entity.ai.workers.crafting.AbstractEntityAICrafting<JobFarmer,BuildingFarmer>
com.minecolonies.core.entity.ai.workers.production.agriculture.EntityAIWorkFarmer
- All Implemented Interfaces:
ITickingStateAI
Farmer AI class. Created: December 20, 2014
-
Field Summary
Fields inherited from class com.minecolonies.core.entity.ai.workers.crafting.AbstractEntityAICrafting
currentRecipeStorage, currentRequest, HIT_DELAY, idlePos, MAX_LEVEL, NO_CHANGE, PROGRESS_MULTIPLIERFields inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract
BLOCK_MINING_DELAY, RANGE_HORIZONTAL_PICKUP, RANGE_VERTICAL_PICKUP, RENDER_META_WORKING, XP_PER_BLOCKFields 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 TypeMethodDescriptionbooleanIf the worker currently has work to do or could also just wander around.protected IAIStatedecide()Main method to decide on what to do.protected intThe number of actions a crafting "success" is worth.protected intCalculates after how many actions the ai should dump it's inventory.intGet the level that affects the break speed.@Nullable AbstractEntityCitizenReturns the farmer's worker instance.Can be overridden in implementations to return the exact building type the worker expects.protected intgetLargestCell(FarmField farmField) protected intbooleanIf the crafter should go in idle mode or not.protected List<net.minecraft.world.item.ItemStack> increaseBlockDrops(List<net.minecraft.world.item.ItemStack> drops) Potentially increase the blockdrops.protected net.minecraft.core.BlockPosnextValidCell(FarmField farmField) Fetch the next available block within the field.voidonBlockDropReception(List<net.minecraft.world.item.ItemStack> blockDrops) Event triggered after receiving a list of block drops.protected voidCan be overridden in implementations.protected booleanCalled to check when the InventoryShouldBeDumped.Methods inherited from class com.minecolonies.core.entity.ai.workers.crafting.AbstractEntityAICrafting
afterDump, checkForItems, craft, executeCraftingAction, finalizeCraftingTask, getCraftingStatName, getExtendedCount, getLootContext, getLootContext, getNextCraftingState, getRecipe, getStateAfterPickUp, hitBlockWithToolInHand, idle, isAfterDumpPickupAllowed, recordCraftingBuildingStats, resetValuesMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract
fillItemsList, gatherItems, getBlockMiningTime, getItemsForPickUp, isItemWorthPickingUp, mineBlock, mineBlock, mineBlock, resetGatheringItems, searchForItems, shouldSilkTouchBlock, triggerMinedBlockMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic
afterRequestPickUp, cancelAsynchRequestForArmor, 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, getTotalRequiredAmount, getWorkingPosition, getWorkingPosition, hasNotDelayed, holdEfficientTool, incrementActionsDone, incrementActionsDone, incrementActionsDoneAndDecSaturation, inventoryNeedsDump, itemsNiceToHave, onException, resetActionsDone, retrieveToolInHut, retrieveToolInTileEntity, setDelay, takeItemStackFromProvider, waitForRequests, walkToBuilding, walkToBuilding, walkToSafePos, walkToTaggedWorkPos, walkToUnSafePos, walkToUnSafePos, walkToWorkPos, walkWithProxy, walkWithProxyMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractAISkeleton
canBeInterrupted, getState, getStateAI, getTickRate, onRemoval, registerGroupTarget, registerTarget, registerTargets, resetAI, setCurrentDelay, tick
-
Constructor Details
-
EntityAIWorkFarmer
Constructor for the Farmer. Defines the tasks the Farmer executes.- Parameters:
job- a farmer 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<JobFarmer,BuildingFarmer> - Returns:
- the building type associated with this AI's worker.
-
wantInventoryDumped
protected boolean wantInventoryDumped()Called to check when the InventoryShouldBeDumped.- Overrides:
wantInventoryDumpedin classAbstractEntityAIBasic<JobFarmer,BuildingFarmer> - Returns:
- true if the conditions are met
-
getActionRewardForCraftingSuccess
protected int getActionRewardForCraftingSuccess()Description copied from class:AbstractEntityAICraftingThe number of actions a crafting "success" is worth. By default, that's 1 action for 1 crafting success. Override this in your subclass to make crafting recipes worth more actions :-)- Overrides:
getActionRewardForCraftingSuccessin classAbstractEntityAICrafting<JobFarmer,BuildingFarmer> - Returns:
- The number of actions a crafting "success" is worth.
-
updateRenderMetaData
protected void updateRenderMetaData()Description copied from class:AbstractEntityAIBasicCan be overridden in implementations.Here the AI can check if the chestBelt has to be re rendered and do it.
- Overrides:
updateRenderMetaDatain classAbstractEntityAICrafting<JobFarmer,BuildingFarmer>
-
decide
Description copied from class:AbstractEntityAICraftingMain method to decide on what to do.- Overrides:
decidein classAbstractEntityAICrafting<JobFarmer,BuildingFarmer> - Returns:
- the next state to go to.
-
hasWorkToDo
public boolean hasWorkToDo()Description copied from class:AbstractEntityAICraftingIf the crafter should go in idle mode or not.- Overrides:
hasWorkToDoin classAbstractEntityAICrafting<JobFarmer,BuildingFarmer> - Returns:
- true if so.
-
getActionsDoneUntilDumping
protected int getActionsDoneUntilDumping()Description copied from class:AbstractEntityAIBasicCalculates after how many actions the ai should dump it's inventory.Override this to change the value.
- Overrides:
getActionsDoneUntilDumpingin classAbstractEntityAICrafting<JobFarmer,BuildingFarmer> - Returns:
- the number of actions done before item dump.
-
nextValidCell
Fetch the next available block within the field. Uses mathematical quadratic equations to determine the coordinates by an index. Considers max radii set in the field gui.- Returns:
- the new offset position
-
getLargestCell
-
onBlockDropReception
Description copied from class:AbstractEntityAIInteractEvent triggered after receiving a list of block drops.- Overrides:
onBlockDropReceptionin classAbstractEntityAIInteract<JobFarmer,BuildingFarmer> - Parameters:
blockDrops- the received items from the block.
-
getLevelDelay
protected int getLevelDelay() -
increaseBlockDrops
protected List<net.minecraft.world.item.ItemStack> increaseBlockDrops(List<net.minecraft.world.item.ItemStack> drops) Description copied from class:AbstractEntityAIInteractPotentially increase the blockdrops. To be overriden by the worker.- Overrides:
increaseBlockDropsin classAbstractEntityAIInteract<JobFarmer,BuildingFarmer> - Parameters:
drops- the drops.- Returns:
- the list of additional drops.
-
getBreakSpeedLevel
public int getBreakSpeedLevel()Description copied from class:AbstractEntityAIInteractGet the level that affects the break speed.- Overrides:
getBreakSpeedLevelin classAbstractEntityAIInteract<JobFarmer,BuildingFarmer> - Returns:
- the level.
-
getCitizen
Returns the farmer's worker instance. Called from outside this class.- Returns:
- citizen object
-
canGoIdle
public boolean canGoIdle()Description copied from class:AbstractEntityAIBasicIf the worker currently has work to do or could also just wander around.- Overrides:
canGoIdlein classAbstractEntityAIBasic<JobFarmer,BuildingFarmer> - Returns:
- true if can go idle.
-