Class RestaurantMenuModule

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

public class RestaurantMenuModule extends AbstractBuildingModule implements IPersistentModule, ITickingModule, IAltersRequiredItems
Minimum stock module.
  • Field Details

    • STOCK_PER_LEVEL

      public static final int STOCK_PER_LEVEL
      Minimum stock it can hold per level.
      See Also:
  • Constructor Details

    • RestaurantMenuModule

      public RestaurantMenuModule(boolean canCook, Function<IBuilding,Integer> expectedStock)
      Create a restaurant menu module.
      Parameters:
      canCook - whether the worker here can cook.
  • Method Details

    • getMenu

      public Set<ItemStorage> getMenu()
      Get the restaurant menu.
      Returns:
      the menu.
    • addMenuItem

      public void addMenuItem(net.minecraft.world.item.ItemStack itemStack)
      Add a new menu item.
      Parameters:
      itemStack - the menu item to add.
    • removeMenuItem

      public void removeMenuItem(net.minecraft.world.item.ItemStack itemStack)
      Remove a menu item.
      Parameters:
      itemStack - the menu item 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.
    • getExpectedStock

      public int getExpectedStock()
      Get the max stock in stacks per menu item.
      Returns:
      the max stock.
    • 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.