Class MinimumStockModule

java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.MinimumStockModule
All Implemented Interfaces:
IAltersRequiredItems, IBuildingModule, IMinimumStockModule, IPersistentModule, ITickingModule, IHasDirty

Minimum stock module.
  • Field Details

  • Constructor Details

    • MinimumStockModule

      public MinimumStockModule()
  • Method Details

    • addMinimumStock

      public void addMinimumStock(net.minecraft.world.item.ItemStack itemStack, int quantity)
      Description copied from interface: IMinimumStockModule
      Add the minimum stock of the warehouse to this building.
      Specified by:
      addMinimumStock in interface IMinimumStockModule
      Parameters:
      itemStack - the itemStack to add.
      quantity - the quantity.
    • removeMinimumStock

      public void removeMinimumStock(net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IMinimumStockModule
      Remove the minimum stock.
      Specified by:
      removeMinimumStock in interface IMinimumStockModule
      Parameters:
      itemStack - the stack to remove.
    • onColonyTick

      public void onColonyTick(@NotNull @NotNull IColony colony)
      Description copied from interface: ITickingModule
      Colony tick hook.
      Specified by:
      onColonyTick in interface ITickingModule
      Parameters:
      colony - the colony the tick is invoked from.
    • isStocked

      public boolean isStocked(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: IMinimumStockModule
      Check if this stack is stocked.
      Specified by:
      isStocked in interface IMinimumStockModule
      Parameters:
      stack - the stack to check.
      Returns:
      true if stocked.
    • alterItemsToBeKept

      public void alterItemsToBeKept(org.apache.logging.log4j.util.TriConsumer<Predicate<net.minecraft.world.item.ItemStack>,Integer,Boolean> consumer)
      Description copied from interface: IAltersRequiredItems
      Check if additional items have to be kept and add to map if necessary.
      Specified by:
      alterItemsToBeKept in interface IAltersRequiredItems
      Parameters:
      consumer - consumer that adds items to it.
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: IPersistentModule
      Deserialize the module.
      Specified by:
      deserializeNBT in interface IPersistentModule
      Parameters:
      compound - the nbt compound.
    • serializeNBT

      public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: IPersistentModule
      Serialize the module from a compound.
      Specified by:
      serializeNBT in interface IPersistentModule
      Parameters:
      compound - the compound.
    • serializeToView

      public void serializeToView(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Description copied from interface: IBuildingModule
      Serialization method to send the module data to the client side.
      Specified by:
      serializeToView in interface IBuildingModule
      Parameters:
      buf - the buffer to write it to.