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

public class CraftingModuleView extends AbstractBuildingModuleView
Client side representation of the crafting module.
  • Field Details

    • recipes

      protected final List<IRecipeStorage> recipes
      The list of recipes the worker knows, correspond to a subset of the recipes in the colony.
    • disabledRecipes

      protected final List<IRecipeStorage> disabledRecipes
      The list of disabled recipes.
  • Constructor Details

    • CraftingModuleView

      public CraftingModuleView()
  • Method Details

    • deserialize

      public void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Description copied from interface: IBuildingModuleView
      Deserialize the data on the client side.
      Parameters:
      buf - the buffer to read it from.
    • getJobEntry

      @Nullable public @Nullable JobEntry 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

      public boolean canLearn(CraftingType type)
      Check if the worker can learn a certain type of recipe.
      Parameters:
      type - the type to check for.
      Returns:
      true if so.
    • getSupportedCraftingTypes

      public Set<CraftingType> getSupportedCraftingTypes()
      Get the supported crafting types.
      Returns:
      a set of types.
    • getId

      @Deprecated public String getId()
      Deprecated.
      Unique id of the crafting module view.
      Returns:
      the id.
    • isPageVisible

      public boolean isPageVisible()
      Description copied from interface: IBuildingModuleView
      Whether 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: IBuildingModuleView
      Get the matching window for the module.
      Returns:
      the window.
    • getIconResourceLocation

      public net.minecraft.resources.ResourceLocation getIconResourceLocation()
      Description copied from interface: IBuildingModuleView
      Get 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: IBuildingModuleView
      Get the lang string for the title.
      Returns:
      the lang string.
    • getRecipes

      public List<IRecipeStorage> 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

      public boolean isDisabled(IRecipeStorage recipe)
      Check if a recipe is disabled.
      Parameters:
      recipe - the recipe to check for.
      Returns:
      true if so.