Package net.uku3lig.ukulib.config.option
Class InputOption
java.lang.Object
net.uku3lig.ukulib.config.option.InputOption
- All Implemented Interfaces:
WidgetCreator
An option to input text.
-
Constructor Summary
ConstructorsConstructorDescriptionInputOption(String suggestionKey, String initialValue, Consumer<String> setter) Constructor.InputOption(String suggestionKey, String initialValue, Consumer<String> setter, Predicate<String> validator) Constructor.InputOption(String suggestionKey, String initialValue, Consumer<String> setter, Predicate<String> 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.
-
Constructor Details
-
InputOption
public InputOption(String suggestionKey, String initialValue, Consumer<String> setter, Predicate<String> validator, int maxLength) Constructor.- Parameters:
suggestionKey- the translation key for the suggestioninitialValue- the initial valuesetter- the callback to set the valuevalidator- the validatormaxLength- the maximum length of the input
-
InputOption
public InputOption(String suggestionKey, String initialValue, Consumer<String> setter, Predicate<String> validator) Constructor. Equivalent toInputOption(suggestionKey, initialValue, setter, validator, 1000).- Parameters:
suggestionKey- the translation key for the suggestioninitialValue- the initial valuesetter- the callback to set the valuevalidator- the validator
-
InputOption
Constructor. Equivalent toInputOption(suggestionKey, initialValue, setter, Objects::nonNull, 1000).- Parameters:
suggestionKey- the translation key for the suggestioninitialValue- the initial valuesetter- the callback to set the value
-
-
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
-