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 Details

    • containerList

      protected final Set<net.minecraft.core.BlockPos> 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,Boolean>> keepX
      List of items the worker should keep. With the quantity and if he should keep it in the inventory as well.
    • tileEntity

      protected AbstractTileEntityColonyBuilding tileEntity
      The tileEntity of the building.
  • Constructor Details

    • AbstractBuildingContainer

      public AbstractBuildingContainer(net.minecraft.core.BlockPos pos, IColony colony)
      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:
      deserializeNBT in interface IBuildingContainer
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      deserializeNBT in class AbstractSchematicProvider
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface IBuildingContainer
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      serializeNBT in class AbstractSchematicProvider
    • getPickUpPriority

      public int getPickUpPriority()
      Description copied from interface: IBuildingContainer
      Get the pick up priority of the building.
      Specified by:
      getPickUpPriority in interface IBuildingContainer
      Returns:
      the priority, an integer.
    • alterPickUpPriority

      public void alterPickUpPriority(int value)
      Description copied from interface: IBuildingContainer
      Increase or decrease the current pickup priority.
      Specified by:
      alterPickUpPriority in interface IBuildingContainer
      Parameters:
      value - the new prio to add to.
    • addContainerPosition

      public void addContainerPosition(@NotNull @NotNull net.minecraft.core.BlockPos pos)
      Description copied from interface: IBuildingContainer
      Add a new container to the building.
      Specified by:
      addContainerPosition in interface IBuildingContainer
      Parameters:
      pos - position to add.
    • removeContainerPosition

      public void removeContainerPosition(net.minecraft.core.BlockPos pos)
      Description copied from interface: IBuildingContainer
      Remove a container from the building.
      Specified by:
      removeContainerPosition in interface IBuildingContainer
      Parameters:
      pos - position to remove.
    • getContainers

      public List<net.minecraft.core.BlockPos> getContainers()
      Description copied from interface: IBuildingContainer
      Get all containers which belong to the building (including hutblock).
      Specified by:
      getContainers in interface IBuildingContainer
      Specified by:
      getContainers in interface ICommonBuilding
      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: IBuildingContainer
      Register a blockState and position. We suppress this warning since this parameter will be used in child classes which override this method.
      Specified by:
      registerBlockPosition in interface IBuildingContainer
      Parameters:
      blockState - to be registered
      pos - of the blockState
      world - 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: IBuildingContainer
      Register a block and position. We suppress this warning since this parameter will be used in child classes which override this method.
      Specified by:
      registerBlockPosition in interface IBuildingContainer
      Parameters:
      block - to be registered
      pos - of the block
      world - 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

      public List<net.minecraft.core.BlockPos> getLocationsFromTag(@NotNull @NotNull String tagName)
      Description copied from interface: IBuilding
      Gets the list of tags, and finds all locations registered there.
      Specified by:
      getLocationsFromTag in interface IBuilding
      Parameters:
      tagName - the name of the tag to query
      Returns:
      all the matching BlockPos, or an empty list if not found
    • setTileEntity

      public void setTileEntity(AbstractTileEntityColonyBuilding te)
      Description copied from interface: IBuildingContainer
      Sets the tile entity for the building.
      Specified by:
      setTileEntity in interface IBuildingContainer
      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:
      getCapability in interface IBuildingContainer
      Specified by:
      getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider