Package net.uku3lig.ukulib.config.option
Class TypedInputOption<T>
java.lang.Object
net.uku3lig.ukulib.config.option.TypedInputOption<T>
- Type Parameters:
T- the type of the value
- All Implemented Interfaces:
WidgetCreator
A
WidgetCreator which creates a TextInputWidget with a converter and validator.-
Constructor Summary
ConstructorsConstructorDescriptionTypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String, Optional<T>> converter) Constructor.TypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String, Optional<T>> converter, Predicate<T> validator) Constructor.TypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String, Optional<T>> converter, Predicate<T> validator, int maxLength) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.client.gui.widget.ClickableWidgetcreateWidget(int x, int y, int width, int height) Creates the widget.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.uku3lig.ukulib.config.option.WidgetCreator
wide
-
Constructor Details
-
TypedInputOption
public TypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String, Optional<T>> converter, Predicate<T> validator, int maxLength) Constructor.- Parameters:
suggestionKey- the translation key for the suggestioninitialValue- the initial valuesetter- the callback to set the valueconverter- the convertervalidator- the validatormaxLength- the maximum length of the input
-
TypedInputOption
public TypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String, Optional<T>> converter, Predicate<T> validator) Constructor. Equivalent toInputOption(suggestionKey, initialValue, setter, converter, validator, 1000).- Parameters:
suggestionKey- the translation key for the suggestioninitialValue- the initial valuesetter- the callback to set the valueconverter- the convertervalidator- the validator
-
TypedInputOption
public TypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String, Optional<T>> converter) Constructor. Equivalent toInputOption(suggestionKey, initialValue, setter, converter, Objects::nonNull, 1000).- Parameters:
suggestionKey- the translation key for the suggestioninitialValue- the initial valuesetter- the callback to set the valueconverter- the converter
-
-
Method Details
-
createWidget
public net.minecraft.client.gui.widget.ClickableWidget createWidget(int x, int y, int width, int height) Description copied from interface:WidgetCreatorCreates the widget.- Specified by:
createWidgetin interfaceWidgetCreator- Parameters:
x- The x positiony- The y positionwidth- The widget widthheight- The widget height- Returns:
- The created widget
-