Class AbstractBuildingContainer
java.lang.Object
com.minecolonies.core.colony.buildings.AbstractSchematicProvider
com.minecolonies.core.colony.buildings.AbstractBuildingContainer
- 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:
AbstractBuilding
public abstract class AbstractBuildingContainer
extends AbstractSchematicProvider
implements IBuildingContainer
Class containing the container action of the buildings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Set<net.minecraft.core.BlockPos>A list which contains the position of all containers which belong to the worker building.protected final Map<Predicate<net.minecraft.world.item.ItemStack>,net.minecraft.util.Tuple<Integer, Boolean>> List of items the worker should keep.protected AbstractTileEntityColonyBuildingThe tileEntity of the building.Fields 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
ConstructorsConstructorDescriptionAbstractBuildingContainer(net.minecraft.core.BlockPos pos, IColony colony) The constructor for the building container. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContainerPosition(@NotNull net.minecraft.core.BlockPos pos) Add a new container to the building.voidalterPickUpPriority(int value) Increase or decrease the current pickup priority.voiddeserializeNBT(net.minecraft.nbt.CompoundTag compound) <T> net.minecraftforge.common.util.LazyOptional<T>getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, net.minecraft.core.Direction side) List<net.minecraft.core.BlockPos>Get all containers which belong to the building (including hutblock).protected net.minecraft.core.BlockPosgetFirstLocationFromTag(@NotNull String tagName) Gets the list of tags, and finds the first location registered there.List<net.minecraft.core.BlockPos>getLocationsFromTag(@NotNull String tagName) Gets the list of tags, and finds all locations registered there.intGet the pick up priority of the building.voidregisterBlockPosition(@NotNull net.minecraft.world.level.block.Block block, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.Level world) Register a block and position.voidregisterBlockPosition(@NotNull net.minecraft.world.level.block.state.BlockState blockState, @NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.Level world) Register a blockState and position.voidremoveContainerPosition(net.minecraft.core.BlockPos pos) Remove a container from the building.net.minecraft.nbt.CompoundTagvoidSets the tile entity for the building.Methods 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, onColonyTick, 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, buildingRequiresCertainAmountOfItem, calculateCorners, calculatePrestige, canAssignCitizens, canBeBuiltByBuilder, canBeGathered, cancelAllRequestsOfCitizenOrBuilding, canEat, canSort, createPickupRequest, createRequest, createRequest, createResolvers, deconstruct, destroy, forceTransferStack, getAllAssignedCitizen, getBuildingDisplayName, getCitizenForRequest, getClaimRadius, getCompletedRequestsOfCitizenOrBuilding, getCompletedRequestsOfType, getCompletedRequestsOfTypeFiltered, getCustomName, getHandlers, getMaxEquipmentLevel, getOpenRequests, getOpenRequestsByRequestableType, getOpenRequestsOfType, getOpenRequestsOfTypeFiltered, getRequester, getRequiredItemsAndAmount, getResolvers, getSetting, getSettingValueOrDefault, hasCitizenCompletedRequests, hasCitizenCompletedRequestsToPickup, hasOpenSyncRequest, hasWorkerOpenRequests, hasWorkerOpenRequestsFiltered, hasWorkerOpenRequestsOfType, isBuilt, isGuardBuildingNear, isItemStackInRequest, isMatchingBlock, isPendingConstruction, markDirty, markRequestAsAccepted, onCleanUp, onDestroyed, onPlacement, onPlayerEnterBuilding, onPlayerEnterNearby, onRestart, onUpgradeComplete, onWakeUp, overruleNextOpenRequestOfCitizenWithStack, overruleNextOpenRequestWithStack, pickUp, processOfflineTime, removeWorkOrder, requestRemoval, requestRepair, requestUpgrade, reservedStacksExcluding, resetGuardBuildingNear, serializeToView, setCustomBuildingName, sortMethods inherited from interface com.minecolonies.api.colony.buildings.IBuildingContainer
getTileEntityMethods inherited from interface com.minecolonies.api.colony.modules.IBuildingModuleContainer
getModule, getModule, hasModule, registerModuleMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapabilityMethods inherited from interface com.minecolonies.api.colony.buildings.ICommonBuilding
getBuildingLevelEquivalent, getPrestigeMethods inherited from interface com.minecolonies.api.colony.modules.IModuleContainer
getClassType, getFirstModuleOccurance, getModule, getModule, getModule, getModuleMatching, getModules, getModules, getModules, getModules, getModulesByType, hasModule, hasModule, hasModuleMethods inherited from interface com.minecolonies.api.colony.requestsystem.requester.IRequester
getId, getLocation, getRequesterDisplayName, onRequestedRequestCancelled, onRequestedRequestCompleteMethods inherited from interface com.minecolonies.api.colony.requestsystem.resolver.IRequestResolverProvider
getIdMethods inherited from interface com.minecolonies.api.colony.buildings.ISchematicProvider
clearDirty, getBlueprintPath, getChildren, getCorners, getID, getMaxBuildingLevel, getParent, getRotation, getSchematicName, getStructurePack, hasParent, isDeconstructed, isDirty, isMirrored, onUpgradeSchematicTo, setBlueprintPath, setBuildingLevel, setCorners, setDeconstructed, setIsMirrored, setParent, setStructurePack
-
Field Details
-
containerList
A list which contains the position of all containers which belong to the worker building. -
keepX
protected final Map<Predicate<net.minecraft.world.item.ItemStack>,net.minecraft.util.Tuple<Integer, keepXBoolean>> List of items the worker should keep. With the quantity and if he should keep it in the inventory as well. -
tileEntity
The tileEntity of the building.
-
-
Constructor Details
-
AbstractBuildingContainer
The constructor for the building container.- Parameters:
pos- the position of it.colony- the colony.
-
-
Method Details
-
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 classAbstractSchematicProvider
-
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 classAbstractSchematicProvider
-
getPickUpPriority
public int getPickUpPriority()Description copied from interface:IBuildingContainerGet the pick up priority of the building.- Specified by:
getPickUpPriorityin interfaceIBuildingContainer- Returns:
- the priority, an integer.
-
alterPickUpPriority
public void alterPickUpPriority(int value) Description copied from interface:IBuildingContainerIncrease or decrease the current pickup priority.- Specified by:
alterPickUpPriorityin interfaceIBuildingContainer- Parameters:
value- the new prio to add to.
-
addContainerPosition
public void addContainerPosition(@NotNull @NotNull net.minecraft.core.BlockPos pos) Description copied from interface:IBuildingContainerAdd a new container to the building.- Specified by:
addContainerPositionin interfaceIBuildingContainer- Parameters:
pos- position to add.
-
removeContainerPosition
public void removeContainerPosition(net.minecraft.core.BlockPos pos) Description copied from interface:IBuildingContainerRemove a container from the building.- Specified by:
removeContainerPositionin interfaceIBuildingContainer- Parameters:
pos- position to remove.
-
getContainers
Description copied from interface:IBuildingContainerGet all containers which belong to the building (including hutblock).- Specified by:
getContainersin interfaceIBuildingContainer- Specified by:
getContainersin interfaceICommonBuilding- Returns:
- a copy of the list to avoid currentModification exception.
-
registerBlockPosition
public void registerBlockPosition(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState blockState, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.Level world) Description copied from interface:IBuildingContainerRegister a blockState and position. We suppress this warning since this parameter will be used in child classes which override this method.- Specified by:
registerBlockPositionin interfaceIBuildingContainer- Parameters:
blockState- to be registeredpos- of the blockStateworld- world to register it at.
-
registerBlockPosition
public void registerBlockPosition(@NotNull @NotNull net.minecraft.world.level.block.Block block, @NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.Level world) Description copied from interface:IBuildingContainerRegister a block and position. We suppress this warning since this parameter will be used in child classes which override this method.- Specified by:
registerBlockPositionin interfaceIBuildingContainer- Parameters:
block- to be registeredpos- of the blockworld- world to register it at.
-
getFirstLocationFromTag
@Nullable protected net.minecraft.core.BlockPos getFirstLocationFromTag(@NotNull @NotNull String tagName) Gets the list of tags, and finds the first location registered there.- Parameters:
tagName- the name of the tag to query- Returns:
- the BlockPos, or null if not found
-
getLocationsFromTag
Description copied from interface:IBuildingGets the list of tags, and finds all locations registered there.- Specified by:
getLocationsFromTagin interfaceIBuilding- Parameters:
tagName- the name of the tag to query- Returns:
- all the matching BlockPos, or an empty list if not found
-
setTileEntity
Description copied from interface:IBuildingContainerSets the tile entity for the building.- Specified by:
setTileEntityin interfaceIBuildingContainer- Parameters:
te- The tileentity
-
getCapability
@Nonnull public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull net.minecraftforge.common.capabilities.Capability<T> cap, @Nullable net.minecraft.core.Direction side) - Specified by:
getCapabilityin interfaceIBuildingContainer- Specified by:
getCapabilityin interfacenet.minecraftforge.common.capabilities.ICapabilityProvider
-