Class EntityAIQuarrier
java.lang.Object
com.minecolonies.core.entity.ai.workers.AbstractAISkeleton<JobQuarrier>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic<JobQuarrier,BuildingMiner>
com.minecolonies.core.entity.ai.workers.AbstractEntityAISkill<JobQuarrier,BuildingMiner>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract<JobQuarrier,BuildingMiner>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure<JobQuarrier,BuildingMiner>
com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructureWithWorkOrder<JobQuarrier,BuildingMiner>
com.minecolonies.core.entity.ai.workers.production.EntityAIQuarrier
- All Implemented Interfaces:
ITickingStateAI
public class EntityAIQuarrier
extends AbstractEntityAIStructureWithWorkOrder<JobQuarrier,BuildingMiner>
Class which handles the quarrier behaviour.
The quarrier digs out a large hole and builds infrastructure around it.
-
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
Fields 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.protected IBuildingGet the building to dump the inventory into.Can be overridden in implementations to return the exact building type the worker expects.intGet the level that affects the place speed.protected net.minecraft.core.BlockPosGet the position the citizen needs to walk to in order to buildnet.minecraft.world.level.block.state.BlockStategetSolidSubstitution(net.minecraft.core.BlockPos worldPos, Function<net.minecraft.core.BlockPos, @Nullable net.minecraft.world.level.block.state.BlockState> virtualBlocks) Searches a handy block to substitute a non-solid space which should be guaranteed solid.net.minecraft.world.item.ItemStackgetTotalAmount(net.minecraft.world.item.ItemStack stack) Check how much of a certain stuck is actually required.protected booleangoToNextStage(com.ldtteam.structurize.placement.StructurePhasePlacementResult result) This method is called when a stage is finished, and it is needed to go to the next stageTakes the existing workorder, loads the structure and tests the worker order if it is valid.voidloadStructure(@NotNull IBuilderWorkOrder workOrder, net.minecraft.core.BlockPos position, boolean removal) Loads the structure given the name, rotation and position.voidonBlockDropReception(List<net.minecraft.world.item.ItemStack> blockDrops) Event triggered after receiving a list of block drops.booleanIterates through all the required resources and stores them in the building.voidSet the structure placer.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.protected booleanskipBuilding(com.ldtteam.structurize.util.BlueprintPositionInfo info, net.minecraft.core.BlockPos pos, com.ldtteam.structurize.placement.structure.IStructureHandler handler) Checks wich blocks are skipped on buildingprotected booleanskipClearing(com.ldtteam.structurize.util.BlueprintPositionInfo info, net.minecraft.core.BlockPos pos, com.ldtteam.structurize.placement.structure.IStructureHandler handler) Checks which blocks are skipped on clearingprotected @NotNull IAIStateStart working at own building.protected IAIStateThe Structure step to execute the actual placement actions etc.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, reduceNeededResources, registerBlockAsNeeded, sendCompletionMessage, storeProgressPosMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure
afterDump, afterRequestPickUp, checkForExtraBuildingActions, completeBuild, getCurrentBuildingPosition, getCurrentWorkingPosition, getStateAfterPickUp, getWorker, getWorkingPosition, hasListOfResInInvOrRequest, isBlockFree, isDecoItem, isThereAStructureToBuild, pickUpMaterial, resetCurrentStructure, startBuildingMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract
fillItemsList, gatherItems, getBlockMiningTime, getItemsForPickUp, increaseBlockDrops, isItemWorthPickingUp, mineBlock, mineBlock, mineBlock, resetGatheringItems, searchForItems, shouldSilkTouchBlockMethods 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, 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
-
Constructor Details
-
EntityAIQuarrier
Constructor for the Quarrier. Defines the tasks the miner executes.- Parameters:
job- a quarrier 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<JobQuarrier,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<JobQuarrier,BuildingMiner> - Returns:
- next state.
-
loadRequirements
Description copied from class:AbstractEntityAIStructureWithWorkOrderTakes the existing workorder, loads the structure and tests the worker order if it is valid.- Overrides:
loadRequirementsin classAbstractEntityAIStructureWithWorkOrder<JobQuarrier,BuildingMiner> - Returns:
- the next state to go to.
-
onBlockDropReception
Description copied from class:AbstractEntityAIInteractEvent triggered after receiving a list of block drops.- Overrides:
onBlockDropReceptionin classAbstractEntityAIInteract<JobQuarrier,BuildingMiner> - Parameters:
blockDrops- the received items from the block.
-
loadStructure
public void loadStructure(@NotNull @NotNull IBuilderWorkOrder workOrder, net.minecraft.core.BlockPos position, boolean removal) Description copied from class:AbstractEntityAIStructureLoads the structure given the name, rotation and position.- Overrides:
loadStructurein classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Parameters:
workOrder- the work order.position- the position to set it.removal- if removal step.
-
getBuildingToDump
Description copied from class:AbstractEntityAIBasicGet the building to dump the inventory into.- Overrides:
getBuildingToDumpin classAbstractEntityAIBasic<JobQuarrier,BuildingMiner> - Returns:
- its own building by default.
-
structureStep
Description copied from class:AbstractEntityAIStructureThe Structure step to execute the actual placement actions etc.- Overrides:
structureStepin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Returns:
- the next step to go to.
-
getPosToWorkAt
protected net.minecraft.core.BlockPos getPosToWorkAt()Description copied from class:AbstractEntityAIStructureGet the position the citizen needs to walk to in order to build- Overrides:
getPosToWorkAtin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Returns:
- the position to go to
-
goToNextStage
protected boolean goToNextStage(com.ldtteam.structurize.placement.StructurePhasePlacementResult result) Description copied from class:AbstractEntityAIStructureThis method is called when a stage is finished, and it is needed to go to the next stage- Overrides:
goToNextStagein classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Returns:
- whether it succeeded, i.e. there was a next stage to go to.
-
skipBuilding
protected boolean skipBuilding(com.ldtteam.structurize.util.BlueprintPositionInfo info, net.minecraft.core.BlockPos pos, com.ldtteam.structurize.placement.structure.IStructureHandler handler) Description copied from class:AbstractEntityAIStructureChecks wich blocks are skipped on building- Overrides:
skipBuildingin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Parameters:
info-pos-handler-- Returns:
-
skipClearing
protected boolean skipClearing(com.ldtteam.structurize.util.BlueprintPositionInfo info, net.minecraft.core.BlockPos pos, com.ldtteam.structurize.placement.structure.IStructureHandler handler) Description copied from class:AbstractEntityAIStructureChecks which blocks are skipped on clearing- Overrides:
skipClearingin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Parameters:
info-pos-handler-- Returns:
-
requestMaterials
public boolean requestMaterials()Description copied from class:AbstractEntityAIStructureIterates through all the required resources and stores them in the building.- Overrides:
requestMaterialsin classAbstractEntityAIStructureWithWorkOrder<JobQuarrier,BuildingMiner> - Returns:
- true if finished.
-
checkIfCanceled
protected boolean checkIfCanceled()Description copied from class:AbstractEntityAIStructureCheck if the structure tusk has been canceled.- Overrides:
checkIfCanceledin classAbstractEntityAIStructureWithWorkOrder<JobQuarrier,BuildingMiner> - Returns:
- true if reset to idle.
-
setStructurePlacer
Description copied from class:AbstractEntityAIStructureSet the structure placer.- Overrides:
setStructurePlacerin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Parameters:
structure- the placer.
-
getBreakSpeedLevel
public int getBreakSpeedLevel()Description copied from class:AbstractEntityAIInteractGet the level that affects the break speed.- Overrides:
getBreakSpeedLevelin classAbstractEntityAIInteract<JobQuarrier,BuildingMiner> - Returns:
- the level.
-
getPlaceSpeedLevel
public int getPlaceSpeedLevel()Description copied from class:AbstractEntityAIStructureGet the level that affects the place speed.- Specified by:
getPlaceSpeedLevelin classAbstractEntityAIStructure<JobQuarrier,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<JobQuarrier,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<JobQuarrier,BuildingMiner>
-
doMining
Description copied from class:AbstractEntityAIStructureSeparate step for mining.- Overrides:
doMiningin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Returns:
- the next state to go to.
-
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<JobQuarrier,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<JobQuarrier,BuildingMiner> - Returns:
- the next state.
-
executeSpecificCompleteActions
public void executeSpecificCompleteActions()Description copied from class:AbstractEntityAIStructureExecute specific actions on loading a structure.- Overrides:
executeSpecificCompleteActionsin classAbstractEntityAIStructureWithWorkOrder<JobQuarrier,BuildingMiner>
-
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<JobQuarrier,BuildingMiner> - Parameters:
worldBlock- the worldblock.worldMetadata- the world metadata.- Returns:
- true if should be overwritten.
-
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<JobQuarrier,BuildingMiner> - Parameters:
currentBlock- the current block it is working on.- Returns:
- true while walking to the site.
-
getSolidSubstitution
public net.minecraft.world.level.block.state.BlockState getSolidSubstitution(net.minecraft.core.BlockPos worldPos, Function<net.minecraft.core.BlockPos, @Nullable net.minecraft.world.level.block.state.BlockState> virtualBlocks) Description copied from class:AbstractEntityAIStructureSearches a handy block to substitute a non-solid space which should be guaranteed solid.- Overrides:
getSolidSubstitutionin classAbstractEntityAIStructure<JobQuarrier,BuildingMiner> - Parameters:
worldPos- the location the block should be at.virtualBlocks- blueprint blocks, fnc may return null if virtual block is not available (then use level instead for getting surrounding block states), pos argument is using world coords- Returns:
- the Block.
-
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<JobQuarrier,BuildingMiner> - Parameters:
position- the position of the block.blockToMine- the mined block.
-