Class InputOption

java.lang.Object
net.uku3lig.ukulib.config.option.InputOption
All Implemented Interfaces:
WidgetCreator

public class InputOption extends Object implements WidgetCreator
An option to input text.
  • 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 suggestion
      initialValue - the initial value
      setter - the callback to set the value
      validator - the validator
      maxLength - the maximum length of the input
    • InputOption

      public InputOption(String suggestionKey, String initialValue, Consumer<String> setter, Predicate<String> validator)
      Constructor. Equivalent to InputOption(suggestionKey, initialValue, setter, validator, 1000).
      Parameters:
      suggestionKey - the translation key for the suggestion
      initialValue - the initial value
      setter - the callback to set the value
      validator - the validator
    • InputOption

      public InputOption(String suggestionKey, String initialValue, Consumer<String> setter)
      Constructor. Equivalent to InputOption(suggestionKey, initialValue, setter, Objects::nonNull, 1000).
      Parameters:
      suggestionKey - the translation key for the suggestion
      initialValue - the initial value
      setter - 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: WidgetCreator
      Creates the widget.
      Specified by:
      createWidget in interface WidgetCreator
      Parameters:
      x - The x position
      y - The y position
      width - The widget width
      height - The widget height
      Returns:
      The created widget