Class EnchantmentCoreWidgets

java.lang.Object
johnsmith.enchantmentcore.api.client.gui.EnchantmentCoreWidgets

public final class EnchantmentCoreWidgets extends Object
Public client GUI API providing Enchantment Core's custom Property-to-WidgetFactory mappings for integration with Config Overhauled configuration screens.

Dependent mods that utilize Enchantment Core's dynamic enchantment properties (such as EnchantableItemListProperty and SlotListProperty) can use this utility to register the corresponding interactive selection widgets onto their own ConfigScreen or WidgetRegistry.

  • Method Summary

    Modifier and Type
    Method
    Description
    createScreenFactory(johnsmith.configoverhauled.api.ConfigManager manager)
    Creates a screen factory function suitable for ConfigManager.setScreenFactory(Function) that constructs a default ConfigScreen pre-populated with Enchantment Core's custom widget mappings.
    static Map<Class<? extends johnsmith.configoverhauled.api.Property<?>>,johnsmith.configoverhauled.api.client.gui.factory.WidgetFactory<?>>
    Retrieves an unmodifiable view of Enchantment Core's custom property-to-widget factory mappings.
    static <P extends johnsmith.configoverhauled.api.Property<?>>
    johnsmith.configoverhauled.api.client.gui.factory.WidgetFactory<P>
    getWidgetFactory(Class<P> propertyClass)
    Retrieves the WidgetFactory registered by Enchantment Core for a specific property class.
    static <R extends johnsmith.configoverhauled.api.client.gui.registry.WidgetRegistry>
    R
    register(R registry)
    Registers all of Enchantment Core's custom property-to-widget mappings into the provided WidgetRegistry.
    static <S extends johnsmith.configoverhauled.api.client.gui.screen.ConfigScreen>
    S
    register(S screen)
    Registers all of Enchantment Core's custom property-to-widget mappings directly into the provided ConfigScreen.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getWidgetFactories

      public static Map<Class<? extends johnsmith.configoverhauled.api.Property<?>>,johnsmith.configoverhauled.api.client.gui.factory.WidgetFactory<?>> getWidgetFactories()
      Retrieves an unmodifiable view of Enchantment Core's custom property-to-widget factory mappings.
      Returns:
      A map binding custom Property classes to their corresponding WidgetFactory constructors.
    • getWidgetFactory

      public static <P extends johnsmith.configoverhauled.api.Property<?>> johnsmith.configoverhauled.api.client.gui.factory.WidgetFactory<P> getWidgetFactory(Class<P> propertyClass)
      Retrieves the WidgetFactory registered by Enchantment Core for a specific property class.
      Type Parameters:
      P - The concrete property type.
      Parameters:
      propertyClass - The target property class token.
      Returns:
      The bound WidgetFactory, or null if the class is not a custom Enchantment Core property.
    • register

      public static <S extends johnsmith.configoverhauled.api.client.gui.screen.ConfigScreen> S register(S screen)
      Registers all of Enchantment Core's custom property-to-widget mappings directly into the provided ConfigScreen.
      Type Parameters:
      S - The concrete configuration screen type.
      Parameters:
      screen - The target configuration screen instance to populate.
      Returns:
      The populated configuration screen instance for fluent chaining.
    • register

      public static <R extends johnsmith.configoverhauled.api.client.gui.registry.WidgetRegistry> R register(R registry)
      Registers all of Enchantment Core's custom property-to-widget mappings into the provided WidgetRegistry.
      Type Parameters:
      R - The concrete widget registry type.
      Parameters:
      registry - The target widget registry to populate.
      Returns:
      The populated widget registry instance for fluent chaining.
    • createScreenFactory

      public static Function<Object,Object> createScreenFactory(johnsmith.configoverhauled.api.ConfigManager manager)
      Creates a screen factory function suitable for ConfigManager.setScreenFactory(Function) that constructs a default ConfigScreen pre-populated with Enchantment Core's custom widget mappings.
      Parameters:
      manager - The target mod's ConfigManager.
      Returns:
      A screen factory function accepting a parent Screen and returning a configured ConfigScreen.