Class EntityAIStructureMiner
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.AbstractEntityAIInteract<J,B>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure<J,B>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructureWithWorkOrder<JobMiner,BuildingMiner>
com.minecolonies.core.entity.ai.workers.production.EntityAIStructureMiner
- All Implemented Interfaces:
ITickingStateAI
public class EntityAIStructureMiner
extends AbstractEntityAIStructureWithWorkOrder<JobMiner,BuildingMiner>
Class which handles the miner behaviour.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructureWithWorkOrder
AbstractEntityAIStructureWithWorkOrder.RequestStageNested classes/interfaces inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure
AbstractEntityAIStructure.ItemCheckResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationLucky ore loot tablestatic final net.minecraft.world.level.storage.loot.parameters.LootContextParamSetThe loot parameter set definitionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intFields inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructureWithWorkOrder
requestProgress, requestStateFields inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure
blockToMine, BUILD_BLOCK_DELAY, DONT_TOUCH_PREDICATE, gotoPos, limitReached, loadingBlueprint, prevBlockPosition, structurePlacer, workFromFields 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 TypeMethodDescriptionThe next state after structure loading.protected booleanCheck if the structure tusk has been canceled.doMining()Separate step for mining.voidExecute specific actions on loading a structure.protected intCalculates after how many actions the ai should dump it's inventory.intGet the level that affects the break speed.Can be overridden in implementations to return the exact building type the worker expects.intGet the level that affects the place speed.net.minecraft.world.item.ItemStackgetTotalAmount(net.minecraft.world.item.ItemStack stack) Check how much of a certain stuck is actually required.net.minecraft.core.BlockPosgetWorkingPosition(net.minecraft.core.BlockPos targetPosition) Calculates the working position.voidonBlockDropReception(List<net.minecraft.world.item.ItemStack> blockDrops) Event triggered after receiving a list of block drops.booleanshallReplaceSolidSubstitutionBlock(net.minecraft.world.level.block.Block worldBlock, net.minecraft.world.level.block.state.BlockState worldMetadata) Check if a solid substitution block should be overwritten in a specific case.booleanshouldSilkTouchBlock(net.minecraft.world.level.block.state.BlockState curBlockState) Check if this specific block should be picked up via silk touch.protected @NotNull IAIStateStart working at own building.protected voidtriggerMinedBlock(@NotNull net.minecraft.core.BlockPos position, @NotNull net.minecraft.world.level.block.state.BlockState blockToMine) Trigger for miners if they want to do something specific per mined block.protected voidCan be overridden in implementations.booleanwalkToConstructionSite(net.minecraft.core.BlockPos currentBlock) Walk to the current construction site.Methods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructureWithWorkOrder
checkIfNeedsItem, getProgressPos, getTotalRequiredAmount, handleSpecificCancelActions, isAlreadyCleared, loadRequirements, reduceNeededResources, registerBlockAsNeeded, requestMaterials, sendCompletionMessage, storeProgressPosMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure
afterDump, afterRequestPickUp, checkForExtraBuildingActions, completeBuild, getCurrentBuildingPosition, getCurrentWorkingPosition, getPosToWorkAt, getSolidSubstitution, getStateAfterPickUp, getWorker, goToNextStage, hasListOfResInInvOrRequest, isBlockFree, isDecoItem, isThereAStructureToBuild, loadStructure, pickUpMaterial, resetCurrentStructure, setStructurePlacer, skipBuilding, skipClearing, startBuilding, structureStepMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract
fillItemsList, gatherItems, getBlockMiningTime, getItemsForPickUp, increaseBlockDrops, isItemWorthPickingUp, mineBlock, mineBlock, mineBlock, resetGatheringItems, searchForItemsMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic
cancelAsynchRequestForArmor, canGoIdle, checkAndTransferFromHut, checkForToolOrWeapon, checkForToolOrWeapon, checkForToolOrWeaponAsync, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreate, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForItemExistOrCreateAsync, checkIfRequestForTagExistOrCreateAsync, getBuildingToDump, getEffectiveSkillLevel, getExceptionTimer, getFakePlayer, getInventory, getInvertedEffectiveSkillLevel, getModuleForJob, getMostEfficientTool, getPrimarySkillLevel, getSecondarySkillLevel, getWorkingPosition, hasNotDelayed, holdEfficientTool, incrementActionsDone, incrementActionsDone, incrementActionsDoneAndDecSaturation, inventoryNeedsDump, isAfterDumpPickupAllowed, 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
-
LUCKY_ORE_PARAM_SET
public static final net.minecraft.world.level.storage.loot.parameters.LootContextParamSet LUCKY_ORE_PARAM_SETThe loot parameter set definition -
LUCKY_ORE_LOOT_TABLE
public static final net.minecraft.resources.ResourceLocation LUCKY_ORE_LOOT_TABLELucky ore loot table -
RENDER_META_TORCH
- See Also:
-
RENDER_META_STONE
- See Also:
-
RENDER_META_SHOVEL
- See Also:
-
RENDER_META_PICKAXE
- See Also:
-
SHAFT_RADIUS
public static final int SHAFT_RADIUS- See Also:
-
-
Constructor Details
-
EntityAIStructureMiner
Constructor for the Miner. Defines the tasks the miner executes.- Parameters:
job- a fisherman 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<JobMiner,BuildingMiner> - Returns:
- the building type associated with this AI's worker.
-
startWorkingAtOwnBuilding
Description copied from class:AbstractEntityAIStructureStart working at own building. Override for worker specific implementations.- Overrides:
startWorkingAtOwnBuildingin classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Returns:
- next state.
-
getBreakSpeedLevel
public int getBreakSpeedLevel()Description copied from class:AbstractEntityAIInteractGet the level that affects the break speed.- Overrides:
getBreakSpeedLevelin classAbstractEntityAIInteract<JobMiner,BuildingMiner> - Returns:
- the level.
-
getPlaceSpeedLevel
public int getPlaceSpeedLevel()Description copied from class:AbstractEntityAIStructureGet the level that affects the place speed.- Specified by:
getPlaceSpeedLevelin classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Returns:
- the level.
-
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 classAbstractEntityAIBasic<JobMiner,BuildingMiner> - 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 classAbstractEntityAIBasic<JobMiner,BuildingMiner>
-
doMining
Description copied from class:AbstractEntityAIStructureSeparate step for mining.- Overrides:
doMiningin classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Returns:
- the next state to go to.
-
shouldSilkTouchBlock
public boolean shouldSilkTouchBlock(net.minecraft.world.level.block.state.BlockState curBlockState) Description copied from class:AbstractEntityAIInteractCheck if this specific block should be picked up via silk touch.- Overrides:
shouldSilkTouchBlockin classAbstractEntityAIInteract<JobMiner,BuildingMiner> - Parameters:
curBlockState- the state to check.- Returns:
- true if so.
-
walkToConstructionSite
public boolean walkToConstructionSite(net.minecraft.core.BlockPos currentBlock) Description copied from class:AbstractEntityAIStructureWalk to the current construction site.Calculates and caches the position where to walk to.
- Specified by:
walkToConstructionSitein classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Parameters:
currentBlock- the current block it is working on.- Returns:
- true while walking to the site.
-
getTotalAmount
public net.minecraft.world.item.ItemStack getTotalAmount(net.minecraft.world.item.ItemStack stack) Description copied from class:AbstractEntityAIStructureWithWorkOrderCheck how much of a certain stuck is actually required.- Overrides:
getTotalAmountin classAbstractEntityAIStructureWithWorkOrder<JobMiner,BuildingMiner> - Parameters:
stack- the stack to check.- Returns:
- the new stack with the correct amount.
-
afterStructureLoading
Description copied from class:AbstractEntityAIStructureThe next state after structure loading.- Overrides:
afterStructureLoadingin classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Returns:
- the next state.
-
executeSpecificCompleteActions
public void executeSpecificCompleteActions()Description copied from class:AbstractEntityAIStructureExecute specific actions on loading a structure.- Overrides:
executeSpecificCompleteActionsin classAbstractEntityAIStructureWithWorkOrder<JobMiner,BuildingMiner>
-
onBlockDropReception
Description copied from class:AbstractEntityAIInteractEvent triggered after receiving a list of block drops.- Overrides:
onBlockDropReceptionin classAbstractEntityAIInteract<JobMiner,BuildingMiner> - Parameters:
blockDrops- the received items from the block.
-
getWorkingPosition
public net.minecraft.core.BlockPos getWorkingPosition(net.minecraft.core.BlockPos targetPosition) Calculates the working position.Takes a min distance from width and length.
Then finds the floor level at that distance and then check if it does contain two air levels.
- Overrides:
getWorkingPositionin classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Parameters:
targetPosition- the position to work at.- Returns:
- BlockPos position to work from.
-
shallReplaceSolidSubstitutionBlock
public boolean shallReplaceSolidSubstitutionBlock(net.minecraft.world.level.block.Block worldBlock, net.minecraft.world.level.block.state.BlockState worldMetadata) Description copied from class:AbstractEntityAIStructureCheck if a solid substitution block should be overwritten in a specific case.- Specified by:
shallReplaceSolidSubstitutionBlockin classAbstractEntityAIStructure<JobMiner,BuildingMiner> - Parameters:
worldBlock- the worldblock.worldMetadata- the world metadata.- Returns:
- true if should be overwritten.
-
triggerMinedBlock
protected void triggerMinedBlock(@NotNull @NotNull net.minecraft.core.BlockPos position, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState blockToMine) Description copied from class:AbstractEntityAIInteractTrigger for miners if they want to do something specific per mined block.- Overrides:
triggerMinedBlockin classAbstractEntityAIInteract<JobMiner,BuildingMiner> - Parameters:
position- the position of the block.blockToMine- the mined block.
-
checkIfCanceled
protected boolean checkIfCanceled()Description copied from class:AbstractEntityAIStructureCheck if the structure tusk has been canceled.- Overrides:
checkIfCanceledin classAbstractEntityAIStructureWithWorkOrder<JobMiner,BuildingMiner> - Returns:
- true if reset to idle.
-