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 Type
    Method
    Description
    createEntry(Property<T> property)
    Dynamically resolves and constructs a UI widget for the specified property using the screen's internal WidgetRegistry.
    void
    Flags the configuration state as modified, triggering network syncs or reload alerts on close.
    <P extends Property<?>>
    void
    registerWidget(Class<P> propertyClass, WidgetFactory<? super P> factory)
    Registers a custom widget factory for a specific property type.
    void
    setDeferredTooltip(List<net.minecraft.util.FormattedCharSequence> tooltip)
    Passes a tooltip to the screen to be rendered at the highest Z-index during the render cycle.
    void
    Replaces the entire widget registry used by this screen.
    void
    Forces 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

      void setDeferredTooltip(List<net.minecraft.util.FormattedCharSequence> tooltip)
      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

      <T> ConfigEntry createEntry(Property<T> property)
      Dynamically resolves and constructs a UI widget for the specified property using the screen's internal WidgetRegistry.
      Type Parameters:
      T - The underlying data type of the property.
      Parameters:
      property - The configuration property to create a widget for.
      Returns:
      A newly constructed ConfigEntry ready 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

      void setWidgetRegistry(WidgetRegistry registry)
      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.