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 Summary
FieldsModifier and TypeFieldDescriptionprotected final Set<ItemStorage> The minimum stock.static final intMinimum stock it can hold per level.Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
ConstructorsConstructorDescriptionRestaurantMenuModule(boolean canCook, Function<IBuilding, Integer> expectedStock) Create a restaurant menu module. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMenuItem(net.minecraft.world.item.ItemStack itemStack) Add a new menu item.voidalterItemsToBeKept(org.apache.logging.log4j.util.TriConsumer<Predicate<net.minecraft.world.item.ItemStack>, Integer, Boolean> consumer) Check if additional items have to be kept and add to map if necessary.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserialize the module.intGet the max stock in stacks per menu item.getMenu()Get the restaurant menu.voidonColonyTick(@NotNull IColony colony) Colony tick hook.voidremoveMenuItem(net.minecraft.world.item.ItemStack itemStack) Remove a menu item.voidserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Serialize the module from a compound.voidserializeToView(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Serialization method to send the module data to the client side.Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
checkDirty, clearDirty, getBuilding, getProducer, markDirty, setBuilding, setProducerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingModule
getBuilding, getProducer, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirty
-
Field Details
-
STOCK_PER_LEVEL
public static final int STOCK_PER_LEVELMinimum stock it can hold per level.- See Also:
-
-
Constructor Details
-
RestaurantMenuModule
Create a restaurant menu module.- Parameters:
canCook- whether the worker here can cook.
-
-
Method Details
-
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
Description copied from interface:ITickingModuleColony tick hook.- Specified by:
onColonyTickin interfaceITickingModule- 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:IAltersRequiredItemsCheck if additional items have to be kept and add to map if necessary.- Specified by:
alterItemsToBeKeptin interfaceIAltersRequiredItems- 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:IPersistentModuleDeserialize the module.- Specified by:
deserializeNBTin interfaceIPersistentModule- 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:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
compound- the compound.
-
serializeToView
public void serializeToView(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IBuildingModuleSerialization method to send the module data to the client side.- Specified by:
serializeToViewin interfaceIBuildingModule- Parameters:
buf- the buffer to write it to.
-