Class AbstractBuildingStructureBuilder
java.lang.Object
com.minecolonies.core.colony.buildings.AbstractSchematicProvider
com.minecolonies.core.colony.buildings.AbstractBuildingContainer
com.minecolonies.core.colony.buildings.AbstractBuilding
com.minecolonies.core.colony.buildings.AbstractBuildingStructureBuilder
- All Implemented Interfaces:
IBuilding,IBuildingContainer,ICommonBuilding,ISchematicProvider,IBuildingModuleContainer,IModuleContainer<IBuildingModule>,IRequester,IRequestResolverProvider,net.minecraftforge.common.capabilities.ICapabilityProvider,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- Direct Known Subclasses:
BuildingBuilder,BuildingMiner
The structureBuilder building.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum upgrade of the building.Fields inherited from class com.minecolonies.core.colony.buildings.AbstractBuilding
BREEDING, modules, modulesMap, USE_SHEARSFields inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingContainer
containerList, keepX, tileEntityFields inherited from class com.minecolonies.core.colony.buildings.AbstractSchematicProvider
cachedRotation, colonyFields inherited from interface com.minecolonies.api.colony.buildings.IBuilding
WOOD_HUT_LEVEL -
Constructor Summary
ConstructorsConstructorDescriptionAbstractBuildingStructureBuilder(IColony c, net.minecraft.core.BlockPos l) Public constructor of the building, creates an object of the building. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNeededResource(@Nullable net.minecraft.world.item.ItemStack res, int amount) Add a new resource to the needed list.intbuildingRequiresCertainAmountOfItem(net.minecraft.world.item.ItemStack stack, List<ItemStorage> localAlreadyKept, boolean inventory, JobEntry jobEntry) Check if the worker requires a certain amount of that item and the alreadykept list contains it.voidcheckOrRequestBucket(@Nullable BuilderBucket requiredResources, ICitizenData worker) Check or request if the contents of a specific batch are in the inventory of the building.voidcomplete(ICitizenData citizen) Do final completion when the Job's current work is complete.voiddeserializeNBT(net.minecraft.nbt.CompoundTag compound) net.minecraft.world.item.ItemStackforceTransferStack(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level world) Try to transfer a stack to one of the inventories of the building and force the transfer.Getter for the blocks to be removed in fluids_remove.intGetter of the max building level.Get the needed resources for the current build.@Nullable BuilderBucketReturn the next bucket to work on.@Nullable Tuple<net.minecraft.core.BlockPos,BuildingProgressStage> Getter for the progress position.Override this method if you want to keep an amount of items in inventory.@Nullable BuilderBucketGet the needed resources for the current build.intBatch size to request for resources, used by the Miner to get multiple nodes of suppliesGet the Work Order for the Job.booleanhasResourceInBucket(net.minecraft.world.item.ItemStack stack) Check if the resources are in the bucket.booleanDoes this job have a Work Order it has claimed?voidGo to the next stage.voidonWorkOrderCancellation(IWorkOrder workOrder) Handle workorder cancellation, reset requests and progress.voidreduceNeededResource(net.minecraft.world.item.ItemStack res, int amount) Reduce a resource of the needed list.booleanrequiresResourceForBuilding(net.minecraft.world.item.ItemStack stack) Check if the structureBuilder requires a certain ItemStack for the current construction.voidResets the needed resources completely.net.minecraft.nbt.CompoundTagvoidserializeToView(@NotNull net.minecraft.network.FriendlyByteBuf buf, boolean fullSync) Method to serialize data to send it to the view.voidsetProgressPos(net.minecraft.core.BlockPos blockPos, BuildingProgressStage stage) Set the progress position of the builder.voidsetTotalStages(int total) Set the total number of stages.voidsetWorkOrder(@Nullable IWorkOrder order) Set a Work Order for this Job.voidsetWorkOrderId(int id) Deprecated.Set workorder ID.Methods inherited from class com.minecolonies.core.colony.buildings.AbstractBuilding
calculateCorners, calculatePrestige, canBeBuiltByBuilder, canBeGathered, cancelAllRequestsOfCitizenOrBuilding, canDeconstruct, clearDirty, createPickupRequest, createRequest, createRequest, createResolvers, deconstruct, destroy, getAllAssignedCitizen, getBuildingDisplayName, getCitizenForRequest, getClaimRadius, getClassType, getCompletedRequestsOfCitizenOrBuilding, getCompletedRequestsOfCitizenOrBuilding, getCompletedRequestsOfType, getCompletedRequestsOfTypeFiltered, getCraftingModuleForRecipe, getCustomName, getHandlers, getId, getLocation, getModule, getModule, getModules, getOpenRequests, getOpenRequestsByCitizen, getOpenRequestsByRequestableType, getOpenRequestsOfCitizenOrBuilding, getOpenRequestsOfType, getOpenRequestsOfTypeFiltered, getPrestige, getRequester, getRequesterDisplayName, getResolvers, getSetting, getSettingValueOrDefault, getTileEntity, hasCitizenCompletedRequests, hasCitizenCompletedRequestsToPickup, hasModule, hasOpenSyncRequest, hasWorkerOpenRequests, hasWorkerOpenRequestsFiltered, hasWorkerOpenRequestsOfType, isBuilt, isDirty, isGuardBuildingNear, isItemStackInRequest, isMatchingBlock, isPendingConstruction, keepFood, markDirty, markRequestAsAccepted, moveToSyncCitizen, onCleanUp, onColonyTick, onDestroyed, onPlacement, onPlayerEnterBuilding, onPlayerEnterNearby, onRequestedRequestCancelled, onRequestedRequestComplete, onRestart, onUpgradeComplete, onWakeUp, overruleNextOpenRequestOfCitizenWithStack, overruleNextOpenRequestWithStack, pickUp, processOfflineTime, registerBlockPosition, registerModule, removeWorkOrder, requestRemoval, requestRepair, requestUpgrade, requestWorkOrder, reservedStacksExcluding, resetGuardBuildingNear, setCustomBuildingName, setupRsDataStore, writeRequestSystemToNBTMethods inherited from class com.minecolonies.core.colony.buildings.AbstractBuildingContainer
addContainerPosition, alterPickUpPriority, getCapability, getContainers, getFirstLocationFromTag, getLocationsFromTag, getPickUpPriority, registerBlockPosition, removeContainerPosition, setTileEntityMethods inherited from class com.minecolonies.core.colony.buildings.AbstractSchematicProvider
asyncPrestigeRecalc, equals, getBlueprintPath, getBuildingLevel, getBuildingType, getChildren, getColony, getCorners, getID, getParent, getPosition, getRotation, getStructurePack, hashCode, hasParent, isDeconstructed, isInBuilding, isMirrored, onUpgradeSchematicTo, safeUpdateTEDataFromSchematic, setBlueprintPath, setBuildingLevel, setBuildingType, setCorners, setDeconstructed, setIsMirrored, setParent, setStructurePack, upgradeBuildingLevelToSchematicDataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.IBuilding
buildingRequiresCertainAmountOfItem, canAssignCitizens, canEat, canSort, getMaxEquipmentLevel, sortMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapabilityMethods inherited from interface com.minecolonies.api.colony.buildings.ICommonBuilding
getBuildingLevelEquivalentMethods inherited from interface com.minecolonies.api.colony.modules.IModuleContainer
getFirstModuleOccurance, getModule, getModule, getModule, getModuleMatching, getModules, getModules, getModules, getModulesByType, hasModule, hasModule, hasModuleMethods inherited from interface com.minecolonies.api.colony.buildings.ISchematicProvider
getBlueprintPath, getChildren, getCorners, getID, getParent, getRotation, getSchematicName, getStructurePack, hasParent, isDeconstructed, isMirrored, onUpgradeSchematicTo, setBlueprintPath, setBuildingLevel, setCorners, setDeconstructed, setIsMirrored, setParent, setStructurePack
-
Field Details
-
MAX_BUILDING_LEVEL
public static final int MAX_BUILDING_LEVELThe maximum upgrade of the building.- See Also:
-
-
Constructor Details
-
AbstractBuildingStructureBuilder
Public constructor of the building, creates an object of the building.- Parameters:
c- the colony.l- the position.
-
-
Method Details
-
getMaxBuildingLevel
public int getMaxBuildingLevel()Getter of the max building level.- Specified by:
getMaxBuildingLevelin interfaceISchematicProvider- Overrides:
getMaxBuildingLevelin classAbstractBuilding- Returns:
- the integer.
-
buildingRequiresCertainAmountOfItem
public int buildingRequiresCertainAmountOfItem(net.minecraft.world.item.ItemStack stack, List<ItemStorage> localAlreadyKept, boolean inventory, JobEntry jobEntry) Description copied from interface:IBuildingCheck if the worker requires a certain amount of that item and the alreadykept list contains it. Always leave one stack behind if the worker requires a certain amount of it. Just to be sure.- Specified by:
buildingRequiresCertainAmountOfItemin interfaceIBuilding- Overrides:
buildingRequiresCertainAmountOfItemin classAbstractBuilding- Parameters:
stack- the stack to check it with.localAlreadyKept- already kept items.inventory- if it should be in the inventory or in the building.jobEntry- the job entry trying to dump.- Returns:
- the amount which can get dumped or 0 if not.
-
getRequiredItemsAndAmount
public Map<Predicate<net.minecraft.world.item.ItemStack>,net.minecraft.util.Tuple<Integer, getRequiredItemsAndAmount()Boolean>> Description copied from class:AbstractBuildingOverride this method if you want to keep an amount of items in inventory. When the inventory is full, everything get's dumped into the building chest. But you can use this method to hold some stacks back.- Specified by:
getRequiredItemsAndAmountin interfaceIBuilding- Overrides:
getRequiredItemsAndAmountin classAbstractBuilding- Returns:
- a list of objects which should be kept.
-
forceTransferStack
public net.minecraft.world.item.ItemStack forceTransferStack(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level world) Description copied from class:AbstractBuildingTry to transfer a stack to one of the inventories of the building and force the transfer.- Specified by:
forceTransferStackin interfaceIBuilding- Overrides:
forceTransferStackin classAbstractBuilding- Parameters:
stack- the stack to transfer.world- the world to do it in.- Returns:
- the itemStack which has been replaced or the itemStack which could not be transfered
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag compound) - Specified by:
deserializeNBTin interfaceIBuildingContainer- Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
deserializeNBTin classAbstractBuilding
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfaceIBuildingContainer- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
serializeNBTin classAbstractBuilding
-
serializeToView
public void serializeToView(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf, boolean fullSync) Method to serialize data to send it to the view.- Specified by:
serializeToViewin interfaceIBuilding- Overrides:
serializeToViewin classAbstractBuilding- Parameters:
buf- the used ByteBuffer.fullSync- Whether it's a full sync
-
getNeededResources
Get the needed resources for the current build.- Returns:
- a new Hashmap.
-
getRequiredResources
Get the needed resources for the current build.- Returns:
- the bucket.
-
hasResourceInBucket
public boolean hasResourceInBucket(net.minecraft.world.item.ItemStack stack) Check if the resources are in the bucket.- Parameters:
stack- the stack to check.- Returns:
- true if so.
-
addNeededResource
public void addNeededResource(@Nullable @Nullable net.minecraft.world.item.ItemStack res, int amount) Add a new resource to the needed list.- Parameters:
res- the resource.amount- the amount.
-
reduceNeededResource
public void reduceNeededResource(net.minecraft.world.item.ItemStack res, int amount) Reduce a resource of the needed list.- Parameters:
res- the resource.amount- the amount.
-
resetNeededResources
public void resetNeededResources()Resets the needed resources completely. -
requiresResourceForBuilding
public boolean requiresResourceForBuilding(net.minecraft.world.item.ItemStack stack) Check if the structureBuilder requires a certain ItemStack for the current construction.- Parameters:
stack- the stack to test.- Returns:
- true if so.
-
setProgressPos
Set the progress position of the builder.- Parameters:
blockPos- the last blockPos.stage- the stage to set.
-
getProgress
Getter for the progress position.- Returns:
- the current progress and stage.
-
getResourceBatchMultiplier
public int getResourceBatchMultiplier()Batch size to request for resources, used by the Miner to get multiple nodes of supplies -
getFluidsToRemove
Getter for the blocks to be removed in fluids_remove.- Returns:
- the blocks to be removed in fluids_remove.
-
checkOrRequestBucket
public void checkOrRequestBucket(@Nullable @Nullable BuilderBucket requiredResources, ICitizenData worker) Check or request if the contents of a specific batch are in the inventory of the building. This ignores the worker inventory (that is remaining stuff from previous rounds, or already belongs to another bucket)- Parameters:
requiredResources- the bucket to check and request.worker- the worker.
-
nextStage
public void nextStage()Go to the next stage. -
setTotalStages
public void setTotalStages(int total) Set the total number of stages.- Parameters:
total- the total.
-
getNextBucket
Return the next bucket to work on.- Returns:
- the next bucket or a tuple with null inside if non available.
-
onWorkOrderCancellation
Handle workorder cancellation, reset requests and progress.- Parameters:
workOrder- the cancelled workorder.
-
hasWorkOrder
public boolean hasWorkOrder()Does this job have a Work Order it has claimed?- Returns:
- true if there is a Work Order claimed by this Job
-
getWorkOrder
Get the Work Order for the Job. Warning: WorkOrder is not cached- Returns:
- WorkOrderBuildDecoration for the Build
-
setWorkOrder
Set a Work Order for this Job.- Parameters:
order- Work Order to associate with this job, or null
-
complete
Do final completion when the Job's current work is complete. -
setWorkOrderId
public void setWorkOrderId(int id) Deprecated.Set workorder ID. Only for backwards compatibility.- Parameters:
id- the work order id.
-