Interface WidgetRegistry

All Known Implementing Classes:
DefaultWidgetRegistry

public interface WidgetRegistry
A client-side registry responsible for mapping Property types to their corresponding WidgetFactory implementations.

This registry securely decouples the common configuration data model from the client-side UI rendering logic, ensuring dedicated servers do not attempt to load GUI classes.

  • Method Summary

    Modifier and Type
    Method
    Description
    createEntry(Property<T> property, ConfigScreen screen, net.minecraft.client.Minecraft mc, Runnable callback)
    Looks up the registered factory for the given property's type and constructs a new UI entry.
    <P extends Property<?>>
    void
    register(Class<P> propertyClass, WidgetFactory<? super P> factory)
    Binds a factory to generate widgets for a specific property type.
  • Method Details

    • register

      <P extends Property<?>> void register(Class<P> propertyClass, WidgetFactory<? super P> factory)
      Binds a factory to generate widgets for a specific property type.
      Type Parameters:
      P - The property type.
      Parameters:
      propertyClass - The class of the property.
      factory - The factory responsible for creating the widget for this property type.
    • createEntry

      <T> ConfigEntry createEntry(Property<T> property, ConfigScreen screen, net.minecraft.client.Minecraft mc, Runnable callback)
      Looks up the registered factory for the given property's type and constructs a new UI entry.
      Type Parameters:
      T - The underlying data type of the property.
      Parameters:
      property - The configuration property to create a widget for.
      screen - The configuration screen hosting the widget.
      mc - The active Minecraft client instance.
      callback - A callback triggered when the widget updates the property's value.
      Returns:
      A newly constructed ConfigEntry.
      Throws:
      IllegalStateException - if no factory is registered for the property's class.