Class EntityAIWorkLumberjack
java.lang.Object
com.minecolonies.core.entity.ai.workers.AbstractAISkeleton<JobLumberjack>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic<JobLumberjack,BuildingLumberjack>
com.minecolonies.core.entity.ai.workers.AbstractEntityAISkill<JobLumberjack,BuildingLumberjack>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract<JobLumberjack,BuildingLumberjack>
com.minecolonies.core.entity.ai.workers.crafting.AbstractEntityAICrafting<JobLumberjack,BuildingLumberjack>
com.minecolonies.core.entity.ai.workers.production.EntityAIWorkLumberjack
- All Implemented Interfaces:
ITickingStateAI
public class EntityAIWorkLumberjack
extends AbstractEntityAICrafting<JobLumberjack,BuildingLumberjack>
The lumberjack AI class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatHorizontal range in which the worker picks up items.static final floatVertical range in which the worker picks up items.static final StringThe render name to render logs.static final StringList of saplings.static final intThe range in which the lumberjack searches for trees.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, 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
ConstructorsConstructorDescriptionEntityAIWorkLumberjack(@NotNull JobLumberjack job) Create a new LumberjackAI. -
Method Summary
Modifier and TypeMethodDescriptionprotected IAIStatedecide()Main method to decide on what to do.voidFill the list of the item positions to gather.protected intThe number of actions a crafting "success" is worth.protected intCalculates after how many actions the ai should dump it's inventory.Can be overridden in implementations to return the exact building type the worker expects.net.minecraft.core.BlockPosgetWorkingPosition(net.minecraft.core.BlockPos targetPosition) Calculates the working position.booleanIf the crafter should go in idle mode or not.protected List<net.minecraft.world.item.ItemStack> increaseBlockDrops(List<net.minecraft.world.item.ItemStack> drops) Drop fungus instead of wart blockprotected booleanisItemWorthPickingUp(net.minecraft.world.item.ItemStack stack) Check if an item is sufficiently interesting to want to go pick it up.voidonBlockDropReception(List<net.minecraft.world.item.ItemStack> blockDrops) Event triggered after receiving a list of block drops.protected voidCan be overridden in implementations.booleanwalkToTree(net.minecraft.core.BlockPos workAt) Walk to the current construction site.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
gatherItems, getBlockMiningTime, getBreakSpeedLevel, getItemsForPickUp, mineBlock, mineBlock, mineBlock, resetGatheringItems, searchForItems, shouldSilkTouchBlock, triggerMinedBlockMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic
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, getTotalRequiredAmount, getWorkingPosition, hasNotDelayed, holdEfficientTool, incrementActionsDone, incrementActionsDone, incrementActionsDoneAndDecSaturation, inventoryNeedsDump, itemsNiceToHave, onException, resetActionsDone, retrieveToolInHut, retrieveToolInTileEntity, setDelay, takeItemStackFromProvider, 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
-
RENDER_META_LOGS
The render name to render logs.- See Also:
-
SEARCH_RANGE
public static final int SEARCH_RANGEThe range in which the lumberjack searches for trees.- See Also:
-
SAPLINGS_LIST
List of saplings.- See Also:
-
RANGE_VERTICAL_PICKUP
public static final float RANGE_VERTICAL_PICKUPVertical range in which the worker picks up items.- See Also:
-
RANGE_HORIZONTAL_PICKUP
public static final float RANGE_HORIZONTAL_PICKUPHorizontal range in which the worker picks up items.- See Also:
-
-
Constructor Details
-
EntityAIWorkLumberjack
Create a new LumberjackAI.- Parameters:
job- the lumberJackJob
-
-
Method Details
-
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<JobLumberjack,BuildingLumberjack> - Returns:
- The number of actions a crafting "success" is worth.
-
getExpectedBuildingClass
Description copied from class:AbstractEntityAIBasicCan be overridden in implementations to return the exact building type the worker expects.- Specified by:
getExpectedBuildingClassin classAbstractEntityAIBasic<JobLumberjack,BuildingLumberjack> - Returns:
- the building type associated with this AI's worker.
-
hasWorkToDo
public boolean hasWorkToDo()Description copied from class:AbstractEntityAICraftingIf the crafter should go in idle mode or not.- Overrides:
hasWorkToDoin classAbstractEntityAICrafting<JobLumberjack,BuildingLumberjack> - Returns:
- true if so.
-
decide
Main method to decide on what to do.The lumberjack is a special worker. In their decision state, they will try to add lumberjack cycles If there's nothing left to craft, they will proceed with woodworking
- Overrides:
decidein classAbstractEntityAICrafting<JobLumberjack,BuildingLumberjack> - Returns:
- the next state to go to.
-
isItemWorthPickingUp
protected boolean isItemWorthPickingUp(net.minecraft.world.item.ItemStack stack) Description copied from class:AbstractEntityAIInteractCheck if an item is sufficiently interesting to want to go pick it up. (This won't stop a worker picking up something else as they pass by, but it makes them not want to go over to it.)- Overrides:
isItemWorthPickingUpin classAbstractEntityAIInteract<JobLumberjack,BuildingLumberjack> - Parameters:
stack- the stack to check.- Returns:
- true if the worker wants to go over to it.
-
onBlockDropReception
Description copied from class:AbstractEntityAIInteractEvent triggered after receiving a list of block drops.- Overrides:
onBlockDropReceptionin classAbstractEntityAIInteract<JobLumberjack,BuildingLumberjack> - Parameters:
blockDrops- the received items from the block.
-
increaseBlockDrops
protected List<net.minecraft.world.item.ItemStack> increaseBlockDrops(List<net.minecraft.world.item.ItemStack> drops) Drop fungus instead of wart block- Overrides:
increaseBlockDropsin classAbstractEntityAIInteract<JobLumberjack,BuildingLumberjack> - Parameters:
drops- the drops.- Returns:
- the list of additional drops.
-
walkToTree
public boolean walkToTree(net.minecraft.core.BlockPos workAt) Walk to the current construction site.Calculates and caches the position where to walk to.
- Parameters:
workAt- block to work at.- Returns:
- true while walking to the site.
-
fillItemsList
public void fillItemsList()Description copied from class:AbstractEntityAIInteractFill the list of the item positions to gather.- Overrides:
fillItemsListin classAbstractEntityAIInteract<JobLumberjack,BuildingLumberjack>
-
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<JobLumberjack,BuildingLumberjack> - Returns:
- the number of actions done before item dump.
-
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<JobLumberjack,BuildingLumberjack>
-
getWorkingPosition
public net.minecraft.core.BlockPos getWorkingPosition(net.minecraft.core.BlockPos targetPosition) Description copied from class:AbstractEntityAIBasicCalculates the working position.Takes the position where the worker would like to work on and return the most appropriate position for it.
- Overrides:
getWorkingPositionin classAbstractEntityAIBasic<JobLumberjack,BuildingLumberjack> - Parameters:
targetPosition- the position to work at.- Returns:
- BlockPos most appropiate position to work from.
-