All Known Subinterfaces:
ICraftingSetting, IStringSetting<S>
All Known Implementing Classes:
BeekeeperCollectionSetting, BlockSetting, BoolSetting, BuilderModeSetting, CrafterRecipeSetting, DynamicTreesSetting, GuardFollowModeSetting, GuardPatrolModeSetting, GuardTaskSetting, IntSetting, RecipeSetting, StringSetting, StringSettingWithDesc

public interface ISetting<S>
Generic ISetting that represents all possible setting objects (string, numbers, boolean, etc).
  • Method Details

    • getLayoutItem

      net.minecraft.resources.ResourceLocation getLayoutItem()
      Get the resource location of the view you want to use for this setting.
      Returns:
      the resource location indicating which view to use.
    • setupHandler

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

      void render(ISettingKey<?> key, com.ldtteam.blockui.Pane rowPane, ICommonSettingsModule settingsModuleView, IBuildingView building, com.ldtteam.blockui.views.BOWindow window)
      Update the handling (e.g update settings text).
      Parameters:
      key - the key of the setting.
      rowPane - the pane of it.
      settingsModuleView - the module view that holds the setting.
      building - the building.
      window - the calling window.
    • trigger

      default void trigger()
      Trigger a setting.
    • isActive

      default boolean isActive(ISettingsModule module)
      Check if this setting is active (provided ISettingsModule.getOptionalSetting(ISettingKey) is used).
      Returns:
      true if the setting is active;
    • shouldHideWhenInactive

      default boolean shouldHideWhenInactive()
      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.
      Returns:
      true if the inactive setting should be hidden.
    • onUpdate

      default void onUpdate(IBuilding building, net.minecraft.server.level.ServerPlayer sender)
      Called when updated.
      Parameters:
      building - the building its updated for.
      sender - the player triggering the update.
    • updateSetting

      default void updateSetting(ISetting<?> setting)
      Allow updating a setting with new data.
      Parameters:
      setting - the setting with new data
    • copyValue

      void copyValue(ISetting<?> setting)
      Copy value from another instance.
      Parameters:
      setting - the setting to copy from
    • setHoverPane

      default void setHoverPane(ISettingKey<?> key, com.ldtteam.blockui.Pane component, ICommonSettingsModule settingsModuleView)
      Generates the hover pane for this setting.
      Parameters:
      key - the key of the setting.
      component - the component to put the hover pane on.
      settingsModuleView - the module view that holds the setting.
    • getInactiveReason

      @Nullable default @Nullable net.minecraft.network.chat.Component getInactiveReason()
      Get the reason why this setting is inactive.
      Returns:
      a component stating why this is inactive, or null if no reason.
    • isActive

      default boolean isActive(ISettingsModuleView module)
      Check if this setting is active (provided ISettingsModule.getOptionalSetting(ISettingKey) is used).
      Returns:
      a component containing a message why this setting is not active, return null if the setting is supposed to be active.
    • getValue

      S getValue()
      Get the setting value.
      Returns:
      the value.
    • getToolTipText

      @Nullable default @Nullable net.minecraft.network.chat.Component getToolTipText()
      Get the tooltip text to render on the button, defaults to null.
      Returns:
      the tooltip component to render on the button.