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
    default void
    Closes the currently active overlay modal popup, if any.
    createEntry(Property<T> property)
    Dynamically resolves and constructs a UI widget for the specified property using the screen's internal WidgetRegistry.
    default boolean
    Checks whether an overlay modal popup is currently open on this screen.
    void
    Flags the configuration state as modified, triggering network syncs or reload alerts on close.
    default void
    Opens an overlay modal popup on top of this configuration screen without replacing the active screen.
    <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.
    • openPopup

      default void openPopup(ConfigPopup popup)
      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:
      true if a popup is currently active.