Class TypedInputOption<T>

java.lang.Object
net.uku3lig.ukulib.config.option.TypedInputOption<T>
All Implemented Interfaces:
WidgetCreator

public class TypedInputOption<T> extends Object implements WidgetCreator
  • 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 suggestion
      initialValue - the initial value
      setter - the callback to set the value
      converter - the converter
      validator - the validator
      maxLength - 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 to InputOption(suggestionKey, initialValue, setter, converter, validator, 1000).
      Parameters:
      suggestionKey - the translation key for the suggestion
      initialValue - the initial value
      setter - the callback to set the value
      converter - the converter
      validator - the validator
    • TypedInputOption

      public TypedInputOption(String suggestionKey, String initialValue, Consumer<T> setter, Function<String,Optional<T>> converter)
      Constructor. Equivalent to InputOption(suggestionKey, initialValue, setter, converter, Objects::nonNull, 1000).
      Parameters:
      suggestionKey - the translation key for the suggestion
      initialValue - the initial value
      setter - the callback to set the value
      converter - 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: 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