Class ItemListModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.ItemListModule
- All Implemented Interfaces:
IBuildingModule,IItemListModule,IPersistentModule,IHasDirty
public class ItemListModule
extends AbstractBuildingModule
implements IItemListModule, IPersistentModule
Abstract class for all buildings which require a filterable list of allowed/blocked items.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
ConstructorsConstructorDescriptionItemListModule(String id) Construct a new grouped itemlist module with the unique list identifier.ItemListModule(String id, ItemStorage... defaultStacks) Construct a new grouped itemlist module with the unique list identifier and default values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItem(ItemStorage item) Add an item to the list.voidClear all in the list.voiddeserializeNBT(net.minecraft.nbt.CompoundTag compound) Deserialize the module.getId()Get the unique id of this module.com.google.common.collect.ImmutableList<ItemStorage>getList()Get a specific itemlist.Get the string identifier of the list.booleanisItemInList(ItemStorage item) Check if the item is an allowed item.voidremoveItem(ItemStorage item) Remove an item from the list.voidReset to defaults (usually but not necessarily the same asIItemListModule.clearItems()).voidserializeNBT(net.minecraft.nbt.CompoundTag compound) Serialize the module from a compound.voidserializeToView(@NotNull net.minecraft.network.FriendlyByteBuf 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
-
Constructor Details
-
ItemListModule
Construct a new grouped itemlist module with the unique list identifier.- Parameters:
id- the list id.
-
ItemListModule
Construct a new grouped itemlist module with the unique list identifier and default values.- Parameters:
id- the list id.defaultStacks- the default values.
-
-
Method Details
-
deserializeNBT
public void deserializeNBT(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(net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
compound- the compound.
-
addItem
Description copied from interface:IItemListModuleAdd an item to the list.- Specified by:
addItemin interfaceIItemListModule- Parameters:
item- the item to add.
-
isItemInList
Description copied from interface:IItemListModuleCheck if the item is an allowed item.- Specified by:
isItemInListin interfaceIItemListModule- Parameters:
item- the item to check.- Returns:
- true if so.
-
removeItem
Description copied from interface:IItemListModuleRemove an item from the list.- Specified by:
removeItemin interfaceIItemListModule- Parameters:
item- the item to remove.
-
getList
Description copied from interface:IItemListModuleGet a specific itemlist.- Specified by:
getListin interfaceIItemListModule- Returns:
- a copy of the list at ID, or an empty list.
-
getListIdentifier
Description copied from interface:IItemListModuleGet the string identifier of the list.- Specified by:
getListIdentifierin interfaceIItemListModule- Returns:
- the string.
-
clearItems
public void clearItems()Description copied from interface:IItemListModuleClear all in the list.- Specified by:
clearItemsin interfaceIItemListModule
-
resetToDefaults
public void resetToDefaults()Description copied from interface:IItemListModuleReset to defaults (usually but not necessarily the same asIItemListModule.clearItems()).- Specified by:
resetToDefaultsin interfaceIItemListModule
-
serializeToView
public void serializeToView(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf 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.
-
getId
Description copied from interface:IItemListModuleGet the unique id of this module.- Specified by:
getIdin interfaceIItemListModule- Returns:
- the id.
-