Class DefaultWidgetRegistry
java.lang.Object
johnsmith.configoverhauled.impl.client.gui.registry.DefaultWidgetRegistry
- All Implemented Interfaces:
WidgetRegistry
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> ConfigEntrycreateEntry(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<?>>
voidregister(Class<P> propertyClass, WidgetFactory<? super P> factory) Binds a factory to generate widgets for a specific property type.
-
Constructor Details
-
DefaultWidgetRegistry
public DefaultWidgetRegistry()
-
-
Method Details
-
register
public <P extends Property<?>> void register(Class<P> propertyClass, WidgetFactory<? super P> factory) Description copied from interface:WidgetRegistryBinds a factory to generate widgets for a specific property type.- Specified by:
registerin interfaceWidgetRegistry- 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
public <T> ConfigEntry createEntry(Property<T> property, ConfigScreen screen, net.minecraft.client.Minecraft mc, Runnable callback) Description copied from interface:WidgetRegistryLooks up the registered factory for the given property's type and constructs a new UI entry.- Specified by:
createEntryin interfaceWidgetRegistry- 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.
-