Class ItemListModuleView
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
com.minecolonies.core.colony.buildings.moduleviews.ItemListModuleView
- All Implemented Interfaces:
IBuildingModuleView,IItemListModuleView
- Direct Known Subclasses:
FloristFlowerListModuleView
Client side version of the abstract class for all buildings which require a filterable list of allowed items.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
buildingView, colonyView -
Constructor Summary
ConstructorsConstructorDescriptionItemListModuleView(String id, net.minecraft.network.chat.Component desc, boolean inverted, Function<IBuildingView, Set<ItemStorage>> allItems) Create a nw grouped item list view for the client side. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItem(ItemStorage item) Add item to the view and notify the server side.voidClear the list of itemsvoiddeserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Deserialize the data on the client side.Get the supplier of the list of all items to display.net.minecraft.network.chat.ComponentgetDesc()Get the lang string for the title.net.minecraft.resources.ResourceLocationGet the resource location of the icon for the module view.getId()Get the unique id of this group (used to sync with server side).intgetSize()Get the size of allowed items.com.ldtteam.blockui.views.BOWindowGet the matching window for the module.booleanisAllowedItem(ItemStorage item) Check if an item is in the list of allowed items.booleanCheck if the list is enabling or disabling.voidremoveItem(ItemStorage item) Remove an item from the view and notify the server side.Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
canBeHiredAs, getBuildingView, getColony, getProducer, setBuildingView, setColonyView, 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.IBuildingModuleView
getBuildingView, getColony, getIcon, getProducer, isPageVisible, setBuildingView, setColonyView, setProducer
-
Constructor Details
-
ItemListModuleView
public ItemListModuleView(String id, net.minecraft.network.chat.Component desc, boolean inverted, Function<IBuildingView, Set<ItemStorage>> allItems) Create a nw grouped item list view for the client side.- Parameters:
id- the id.desc- desc lang string.inverted- enabling or disabling.allItems- a supplier for all the items.
-
-
Method Details
-
addItem
Description copied from interface:IItemListModuleViewAdd item to the view and notify the server side.- Specified by:
addItemin interfaceIItemListModuleView- Parameters:
item- the item to add.
-
isAllowedItem
Description copied from interface:IItemListModuleViewCheck if an item is in the list of allowed items.- Specified by:
isAllowedItemin interfaceIItemListModuleView- Parameters:
item- the item to check.- Returns:
- true if so.
-
getSize
public int getSize()Description copied from interface:IItemListModuleViewGet the size of allowed items.- Specified by:
getSizein interfaceIItemListModuleView- Returns:
- the size.
-
removeItem
Description copied from interface:IItemListModuleViewRemove an item from the view and notify the server side.- Specified by:
removeItemin interfaceIItemListModuleView- Parameters:
item- the item to remove.
-
getId
Description copied from interface:IItemListModuleViewGet the unique id of this group (used to sync with server side).- Specified by:
getIdin interfaceIItemListModuleView- Returns:
- the id.
-
getAllItems
Description copied from interface:IItemListModuleViewGet the supplier of the list of all items to display.- Specified by:
getAllItemsin interfaceIItemListModuleView- Returns:
- the list.
-
isInverted
public boolean isInverted()Description copied from interface:IItemListModuleViewCheck if the list is enabling or disabling.- Specified by:
isInvertedin interfaceIItemListModuleView- Returns:
- true if enabling.
-
clearItems
public void clearItems()Description copied from interface:IItemListModuleViewClear the list of items- Specified by:
clearItemsin interfaceIItemListModuleView
-
getDesc
public net.minecraft.network.chat.Component getDesc()Description copied from interface:IBuildingModuleViewGet the lang string for the title.- Specified by:
getDescin interfaceIBuildingModuleView- Returns:
- the lang string.
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IBuildingModuleViewDeserialize the data on the client side.- Specified by:
deserializein interfaceIBuildingModuleView- Parameters:
buf- the buffer to read it from.
-
getWindow
public com.ldtteam.blockui.views.BOWindow getWindow()Description copied from interface:IBuildingModuleViewGet the matching window for the module.- Specified by:
getWindowin interfaceIBuildingModuleView- Returns:
- the window.
-
getIconResourceLocation
public net.minecraft.resources.ResourceLocation getIconResourceLocation()Description copied from interface:IBuildingModuleViewGet the resource location of the icon for the module view.- Specified by:
getIconResourceLocationin interfaceIBuildingModuleView- Returns:
- the resource location.
-