Interface ISetting<S>
- 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 Summary
Modifier and TypeMethodDescriptionvoidCopy value from another instance.default @Nullable net.minecraft.network.chat.ComponentGet the reason why this setting is inactive.net.minecraft.resources.ResourceLocationGet the resource location of the view you want to use for this setting.default @Nullable net.minecraft.network.chat.ComponentGet the tooltip text to render on the button, defaults to null.getValue()Get the setting value.default booleanisActive(ISettingsModule module) Check if this setting is active (providedISettingsModule.getOptionalSetting(ISettingKey)is used).default booleanisActive(ISettingsModuleView module) Check if this setting is active (providedISettingsModule.getOptionalSetting(ISettingKey)is used).default voidCalled when updated.voidrender(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).default voidsetHoverPane(ISettingKey<?> key, com.ldtteam.blockui.Pane component, ICommonSettingsModule settingsModuleView) Generates the hover pane for this setting.voidsetupHandler(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.default booleanConfigures if this setting is inactive, whether it should show in the settings at all.default voidtrigger()Trigger a setting.default voidupdateSetting(ISetting<?> setting) Allow updating a setting with new data.
-
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
Check if this setting is active (providedISettingsModule.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
Called when updated.- Parameters:
building- the building its updated for.sender- the player triggering the update.
-
updateSetting
Allow updating a setting with new data.- Parameters:
setting- the setting with new data
-
copyValue
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
Check if this setting is active (providedISettingsModule.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.
-