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 TypeMethodDescription<T> ConfigEntrycreateEntry(Property<T> property) Dynamically resolves and constructs a UI widget for the specified property using the screen's internalWidgetRegistry.voidFlags the configuration state as modified, triggering network syncs or reload alerts on close.<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.
-