Interface ConfigScreen
- All Known Implementing Classes:
AbstractConfigScreen, DefaultConfigScreen
public interface ConfigScreen
Represents the core API contract for a configuration screen.
Provides standardized methods for UI widgets to interact with the screen's lifecycle, render cycle, and encapsulated widget generation logic.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCloses the currently active overlay modal popup, if any.<T> ConfigEntrycreateEntry(Property<T> property) Dynamically resolves and constructs a UI widget for the specified property using the screen's internalWidgetRegistry.default booleanChecks whether an overlay modal popup is currently open on this screen.voidFlags the configuration state as modified, triggering network syncs or reload alerts on close.default voidopenPopup(ConfigPopup popup) Opens an overlay modal popup on top of this configuration screen without replacing the active screen.<P extends Property<?>>
voidregisterWidget(Class<P> propertyClass, WidgetFactory<? super P> factory) Registers a custom widget factory for a specific property type.voidsetDeferredTooltip(List<net.minecraft.util.FormattedCharSequence> tooltip) Passes a tooltip to the screen to be rendered at the highest Z-index during the render cycle.voidsetWidgetRegistry(WidgetRegistry registry) Replaces the entire widget registry used by this screen.voidForces an evaluation of the global "Reset All" button state.
-
Method Details
-
markLevelConfigModified
void markLevelConfigModified()Flags the configuration state as modified, triggering network syncs or reload alerts on close. -
setDeferredTooltip
Passes a tooltip to the screen to be rendered at the highest Z-index during the render cycle.- Parameters:
tooltip- The formatted lines of text to display.
-
createEntry
Dynamically resolves and constructs a UI widget for the specified property using the screen's internalWidgetRegistry.- Type Parameters:
T- The underlying data type of the property.- Parameters:
property- The configuration property to create a widget for.- Returns:
- A newly constructed
ConfigEntryready to be appended to the screen.
-
updateMasterResetButton
void updateMasterResetButton()Forces an evaluation of the global "Reset All" button state. Called whenever a child widget modifies its value. -
registerWidget
<P extends Property<?>> void registerWidget(Class<P> propertyClass, WidgetFactory<? super P> factory) Registers a custom widget factory for a specific property type. Overrides the default widget if one already exists for the provided class.- Type Parameters:
P- The property type.- Parameters:
propertyClass- The class of the property.factory- The factory responsible for creating the widget.
-
setWidgetRegistry
Replaces the entire widget registry used by this screen. Must be called before the screen initializes its internal lists.- Parameters:
registry- The custom registry implementation to use.
-
openPopup
Opens an overlay modal popup on top of this configuration screen without replacing the active screen. If a popup is already open, it will be closed before opening the new one.- Parameters:
popup- The popup to display.
-
closePopup
default void closePopup()Closes the currently active overlay modal popup, if any. -
hasActivePopup
default boolean hasActivePopup()Checks whether an overlay modal popup is currently open on this screen.- Returns:
trueif a popup is currently active.
-