java.lang.Object
com.minecolonies.core.colony.buildings.modules.settings.RecipeSetting
All Implemented Interfaces:
ICraftingSetting, ISetting<IToken<?>>

public class RecipeSetting extends Object implements ICraftingSetting
Stores a recipe based setting.
  • Field Details

    • selectedRecipe

      protected IToken<?> selectedRecipe
      Current index of the setting.
    • craftingModuleId

      protected final String craftingModuleId
      The specific crafting module.
  • Constructor Details

    • RecipeSetting

      public RecipeSetting(String craftingModuleId)
      Create a new crafting setting.
      Parameters:
      craftingModuleId - the crafting module id.
    • RecipeSetting

      public RecipeSetting(IToken<?> selectedRecipe, String craftingModuleId)
      Create a new string list setting.
      Parameters:
      selectedRecipe - the current selected recipe.
      craftingModuleId - the crafting module id.
  • Method Details

    • getValue

      public IRecipeStorage getValue(IBuilding building)
      Description copied from interface: ICraftingSetting
      Get the setting value.
      Specified by:
      getValue in interface ICraftingSetting
      Returns:
      the current value.
    • getValue

      public IRecipeStorage getValue(IBuildingView building)
      Description copied from interface: ICraftingSetting
      Get the setting value.
      Specified by:
      getValue in interface ICraftingSetting
      Returns:
      the current value.
    • getSettings

      public List<net.minecraft.world.item.ItemStack> getSettings(IBuilding building)
      Description copied from interface: ICraftingSetting
      Get the list of all settings.
      Specified by:
      getSettings in interface ICraftingSetting
      Parameters:
      building - server side building.
      Returns:
      the list.
    • getSettings

      public List<net.minecraft.world.item.ItemStack> getSettings(IBuildingView building)
      Description copied from interface: ICraftingSetting
      Get the list of all settings.
      Specified by:
      getSettings in interface ICraftingSetting
      Parameters:
      building - client side building.
      Returns:
      a copy of the list.
    • getLayoutItem

      public net.minecraft.resources.ResourceLocation getLayoutItem()
      Description copied from interface: ISetting
      Get the resource location of the view you want to use for this setting.
      Specified by:
      getLayoutItem in interface ISetting<IToken<?>>
      Returns:
      the resource location indicating which view to use.
    • setupHandler

      public void setupHandler(ISettingKey<?> key, com.ldtteam.blockui.Pane pane, ICommonSettingsModule settingsModuleView, IBuildingView building, com.ldtteam.blockui.views.BOWindow window)
      Description copied from interface: ISetting
      Add the handling of the specific setting to the box in the UI.
      Specified by:
      setupHandler in interface ISetting<IToken<?>>
      Parameters:
      key - the key of the setting.
      pane - the pane of it.
      settingsModuleView - the module view that holds the setting.
      building - the building.
      window - the calling window.
    • render

      public void render(ISettingKey<?> key, com.ldtteam.blockui.Pane pane, ICommonSettingsModule settingsModuleView, IBuildingView building, com.ldtteam.blockui.views.BOWindow window)
      Description copied from interface: ISetting
      Update the handling (e.g update settings text).
      Specified by:
      render in interface ISetting<IToken<?>>
      Parameters:
      key - the key of the setting.
      pane - the pane of it.
      settingsModuleView - the module view that holds the setting.
      building - the building.
      window - the calling window.
    • set

      public void set(IRecipeStorage value)
      Description copied from interface: ICraftingSetting
      Set the setting to a specific index.
      Specified by:
      set in interface ICraftingSetting
      Parameters:
      value - the value to set.
    • isActive

      public boolean isActive(ISettingsModule module)
      Description copied from interface: ISetting
      Check if this setting is active (provided ISettingsModule.getOptionalSetting(ISettingKey) is used).
      Specified by:
      isActive in interface ISetting<IToken<?>>
      Returns:
      true if the setting is active;
    • isActive

      public boolean isActive(ISettingsModuleView module)
      Description copied from interface: ISetting
      Check if this setting is active (provided ISettingsModule.getOptionalSetting(ISettingKey) is used).
      Specified by:
      isActive in interface ISetting<IToken<?>>
      Returns:
      a component containing a message why this setting is not active, return null if the setting is supposed to be active.
    • getValue

      public IToken<?> getValue()
      Description copied from interface: ISetting
      Get the setting value.
      Specified by:
      getValue in interface ISetting<IToken<?>>
      Returns:
      the value.
    • shouldHideWhenInactive

      public boolean shouldHideWhenInactive()
      Description copied from interface: ISetting
      Configures if this setting is inactive, whether it should show in the settings at all. This would default to false in most cases as we want to prevent not showing settings, but certain settings related to addon mods may want to be hidden if another mod is not loaded.
      Specified by:
      shouldHideWhenInactive in interface ISetting<IToken<?>>
      Returns:
      true if the inactive setting should be hidden.
    • copyValue

      public void copyValue(ISetting<?> setting)
      Description copied from interface: ISetting
      Copy value from another instance.
      Specified by:
      copyValue in interface ISetting<IToken<?>>
      Parameters:
      setting - the setting to copy from