Class EnchantmentCoreWidgets
java.lang.Object
johnsmith.enchantmentcore.api.client.gui.EnchantmentCoreWidgets
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 TypeMethodDescriptioncreateScreenFactory(johnsmith.configoverhauled.api.ConfigManager manager) Creates a screen factory function suitable forConfigManager.setScreenFactory(Function)that constructs a defaultConfigScreenpre-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 theWidgetFactoryregistered by Enchantment Core for a specific property class.static <R extends johnsmith.configoverhauled.api.client.gui.registry.WidgetRegistry>
Rregister(R registry) Registers all of Enchantment Core's custom property-to-widget mappings into the providedWidgetRegistry.static <S extends johnsmith.configoverhauled.api.client.gui.screen.ConfigScreen>
Sregister(S screen) Registers all of Enchantment Core's custom property-to-widget mappings directly into the providedConfigScreen.
-
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
Propertyclasses to their correspondingWidgetFactoryconstructors.
-
getWidgetFactory
public static <P extends johnsmith.configoverhauled.api.Property<?>> johnsmith.configoverhauled.api.client.gui.factory.WidgetFactory<P> getWidgetFactory(Class<P> propertyClass) Retrieves theWidgetFactoryregistered 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, ornullif 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 providedConfigScreen.- 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 providedWidgetRegistry.- 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 forConfigManager.setScreenFactory(Function)that constructs a defaultConfigScreenpre-populated with Enchantment Core's custom widget mappings.- Parameters:
manager- The target mod'sConfigManager.- Returns:
- A screen factory function accepting a parent
Screenand returning a configuredConfigScreen.
-