Class CraftingModuleView
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
com.minecolonies.core.colony.buildings.moduleviews.CraftingModuleView
- All Implemented Interfaces:
IBuildingModuleView
- Direct Known Subclasses:
DOCraftingModuleView
Client side representation of the crafting module.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<IRecipeStorage>The list of disabled recipes.protected final List<IRecipeStorage>The list of recipes the worker knows, correspond to a subset of the recipes in the colony.Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
buildingView, colonyView -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanLearn(CraftingType type) Check if the worker can learn a certain type of recipe.voiddeserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Deserialize the data on the client side.intnet.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()Deprecated.@Nullable JobEntryGets the job associated with this crafting module.intGet a list of all recipes.Get the supported crafting types.com.ldtteam.blockui.views.BOWindowGet the matching window for the module.booleanisDisabled(IRecipeStorage recipe) Check if a recipe is disabled.booleanWhether this module appears as a GUI page.booleanCheck if recipes can be taught.voidvoidremoveRecipe(int index) Remove the recipe at index.voidswitchOrder(int i, int j, boolean fullMove) Switch order in recipe list.voidtoggle(int row) Enable/disable a recipe.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
getIcon
-
Field Details
-
recipes
The list of recipes the worker knows, correspond to a subset of the recipes in the colony. -
disabledRecipes
The list of disabled recipes.
-
-
Constructor Details
-
CraftingModuleView
public CraftingModuleView()
-
-
Method Details
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:IBuildingModuleViewDeserialize the data on the client side.- Parameters:
buf- the buffer to read it from.
-
getJobEntry
Gets the job associated with this crafting module.- Returns:
- The job, or null if there was no such job.
-
isRecipeAlterationAllowed
public boolean isRecipeAlterationAllowed()Check if recipes can be taught.- Returns:
- true if so.
-
canLearn
Check if the worker can learn a certain type of recipe.- Parameters:
type- the type to check for.- Returns:
- true if so.
-
getSupportedCraftingTypes
Get the supported crafting types.- Returns:
- a set of types.
-
getId
Deprecated.Unique id of the crafting module view.- Returns:
- the id.
-
isPageVisible
public boolean isPageVisible()Description copied from interface:IBuildingModuleViewWhether this module appears as a GUI page.- Returns:
- true to show the GUI page.
-
getWindow
public com.ldtteam.blockui.views.BOWindow getWindow()Description copied from interface:IBuildingModuleViewGet the matching window for the module.- 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.- Returns:
- the resource location.
-
getDesc
public net.minecraft.network.chat.Component getDesc()Description copied from interface:IBuildingModuleViewGet the lang string for the title.- Returns:
- the lang string.
-
getRecipes
Get a list of all recipes.- Returns:
- the list.
-
removeRecipe
public void removeRecipe(int index) Remove the recipe at index.- Parameters:
index- the index to remove.
-
switchOrder
public void switchOrder(int i, int j, boolean fullMove) Switch order in recipe list.- Parameters:
i- first index.j- second index.
-
getActiveRecipes
public int getActiveRecipes() -
getMaxRecipes
public int getMaxRecipes() -
openCraftingGUI
public void openCraftingGUI() -
toggle
public void toggle(int row) Enable/disable a recipe.- Parameters:
row- the location of the recipe.
-
isDisabled
Check if a recipe is disabled.- Parameters:
recipe- the recipe to check for.- Returns:
- true if so.
-