Class EntityAIStructureBuilder
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<JobBuilder,BuildingBuilder>
com.minecolonies.core.entity.ai.workers.builder.EntityAIStructureBuilder
- All Implemented Interfaces:
ITickingStateAI
public class EntityAIStructureBuilder
extends AbstractEntityAIStructureWithWorkOrder<JobBuilder,BuildingBuilder>
AI class for the builder. Manages building and repairing buildings.
-
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
ConstructorsConstructorDescriptionEntityAIStructureBuilder(@NotNull JobBuilder job) Initialize the builder and add all his tasks. -
Method Summary
Modifier and TypeMethodDescriptionState to go to after dumping.What to do after picking up a request.booleanIf the worker currently has work to do or could also just wander around.voidCheck for extra building options to do with each block.protected intCalculates after how many actions the AI should dump its inventory.intgetBlockMiningTime(@NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull net.minecraft.core.BlockPos pos) Calculate how long it takes to mine this block.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.booleanChecks whether automatic pickups after dumps are allowed.protected booleanmineBlock(@NotNull net.minecraft.core.BlockPos blockToMine, @NotNull net.minecraft.core.BlockPos safeStand) Will simulate mining a block with particles ItemDrop etc.protected voidSend a completion message to the colony if necessary.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 IAIStateStart working at own building.booleanwalkToConstructionSite(net.minecraft.core.BlockPos currentBlock) Walk to the current construction site.Methods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructureWithWorkOrder
checkIfCanceled, checkIfNeedsItem, executeSpecificCompleteActions, getProgressPos, getTotalAmount, getTotalRequiredAmount, handleSpecificCancelActions, isAlreadyCleared, loadRequirements, reduceNeededResources, registerBlockAsNeeded, requestMaterials, storeProgressPosMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIStructure
afterStructureLoading, completeBuild, doMining, getCurrentBuildingPosition, getCurrentWorkingPosition, getPosToWorkAt, getSolidSubstitution, getStateAfterPickUp, getWorker, getWorkingPosition, goToNextStage, hasListOfResInInvOrRequest, isBlockFree, isDecoItem, isThereAStructureToBuild, loadStructure, pickUpMaterial, resetCurrentStructure, skipBuilding, skipClearing, startBuilding, structureStepMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIInteract
fillItemsList, gatherItems, getItemsForPickUp, increaseBlockDrops, isItemWorthPickingUp, mineBlock, mineBlock, onBlockDropReception, resetGatheringItems, searchForItems, shouldSilkTouchBlock, triggerMinedBlockMethods inherited from class com.minecolonies.core.entity.ai.workers.AbstractEntityAIBasic
cancelAsynchRequestForArmor, 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, 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
-
Constructor Details
-
EntityAIStructureBuilder
Initialize the builder and add all his tasks.- Parameters:
job- the job he has.
-
-
Method Details
-
getBreakSpeedLevel
public int getBreakSpeedLevel()Description copied from class:AbstractEntityAIInteractGet the level that affects the break speed.- Overrides:
getBreakSpeedLevelin classAbstractEntityAIInteract<JobBuilder,BuildingBuilder> - Returns:
- the level.
-
getPlaceSpeedLevel
public int getPlaceSpeedLevel()Description copied from class:AbstractEntityAIStructureGet the level that affects the place speed.- Specified by:
getPlaceSpeedLevelin classAbstractEntityAIStructure<JobBuilder,BuildingBuilder> - Returns:
- the level.
-
getExpectedBuildingClass
Description copied from class:AbstractEntityAIBasicCan be overridden in implementations to return the exact building type the worker expects.- Specified by:
getExpectedBuildingClassin classAbstractEntityAIBasic<JobBuilder,BuildingBuilder> - Returns:
- the building type associated with this AI's worker.
-
setStructurePlacer
Description copied from class:AbstractEntityAIStructureSet the structure placer.- Overrides:
setStructurePlacerin classAbstractEntityAIStructure<JobBuilder,BuildingBuilder> - Parameters:
structure- the placer.
-
isAfterDumpPickupAllowed
public boolean isAfterDumpPickupAllowed()Description copied from class:AbstractEntityAIBasicChecks whether automatic pickups after dumps are allowed. Usually we want this, but if the worker is currently crafting/building, he will handle deliveries/afterdumps in their resolvers, so we can disable automatic pickups in that time. Note that this is just a efficiency-thing. It doesn't hurt when the dman does a pickup during crafting, it's just a wasted run. Therefore, this flag is only considered for *automatic* pickups after dump. It is *ignored* for player-triggered forcePickups, and when the inventory is full.- Overrides:
isAfterDumpPickupAllowedin classAbstractEntityAIBasic<JobBuilder,BuildingBuilder> - Returns:
- true if after-dump pickups are allowed currently.
-
startWorkingAtOwnBuilding
Description copied from class:AbstractEntityAIStructureStart working at own building. Override for worker specific implementations.- Overrides:
startWorkingAtOwnBuildingin classAbstractEntityAIStructure<JobBuilder,BuildingBuilder> - Returns:
- next state.
-
checkForExtraBuildingActions
public void checkForExtraBuildingActions()Description copied from class:AbstractEntityAIStructureCheck for extra building options to do with each block.- Overrides:
checkForExtraBuildingActionsin classAbstractEntityAIStructure<JobBuilder,BuildingBuilder>
-
mineBlock
protected boolean mineBlock(@NotNull @NotNull net.minecraft.core.BlockPos blockToMine, @NotNull @NotNull net.minecraft.core.BlockPos safeStand) Description copied from class:AbstractEntityAIInteractWill simulate mining a block with particles ItemDrop etc. Attention: Because it simulates delay, it has to be called 2 times. So make sure the code path up to this function is reachable a second time. And make sure to immediately exit the update function when this returns false.- Overrides:
mineBlockin classAbstractEntityAIInteract<JobBuilder,BuildingBuilder> - Parameters:
blockToMine- the block that should be minedsafeStand- the block we want to stand on to do that- Returns:
- true once we're done
-
afterRequestPickUp
Description copied from class:AbstractEntityAIBasicWhat to do after picking up a request.- Overrides:
afterRequestPickUpin classAbstractEntityAIStructure<JobBuilder,BuildingBuilder> - Returns:
- the next state to go to.
-
afterDump
Description copied from class:AbstractEntityAIBasicState to go to after dumping.- Overrides:
afterDumpin classAbstractEntityAIStructure<JobBuilder,BuildingBuilder> - Returns:
- the next state.
-
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<JobBuilder,BuildingBuilder> - Parameters:
currentBlock- the current block it is working on.- Returns:
- true while walking to the site.
-
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<JobBuilder,BuildingBuilder> - Parameters:
worldBlock- the worldblock.worldMetadata- the world metadata.- Returns:
- true if should be overwritten.
-
getBlockMiningTime
public int getBlockMiningTime(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState state, @NotNull @NotNull net.minecraft.core.BlockPos pos) Description copied from class:AbstractEntityAIInteractCalculate how long it takes to mine this block.- Overrides:
getBlockMiningTimein classAbstractEntityAIInteract<JobBuilder,BuildingBuilder> - Parameters:
state- the blockstatepos- coordinate- Returns:
- the delay in ticks
-
getActionsDoneUntilDumping
protected int getActionsDoneUntilDumping()Calculates after how many actions the AI should dump its inventory.- Overrides:
getActionsDoneUntilDumpingin classAbstractEntityAIBasic<JobBuilder,BuildingBuilder> - Returns:
- the number of actions done before item dump.
-
sendCompletionMessage
Description copied from class:AbstractEntityAIStructureWithWorkOrderSend a completion message to the colony if necessary.- Overrides:
sendCompletionMessagein classAbstractEntityAIStructureWithWorkOrder<JobBuilder,BuildingBuilder> - Parameters:
wo- the completed workorder.
-
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<JobBuilder,BuildingBuilder> - Returns:
- true if can go idle.
-