Class IntSliderOption

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

public class IntSliderOption extends Object implements WidgetCreator
An int option, represented by a slider.
See Also:
  • Field Details

    • DEFAULT_INT_TO_TEXT

      public static final IntFunction<net.minecraft.text.Text> DEFAULT_INT_TO_TEXT
      Converts an int to Text using its String representation.
  • Constructor Details

    • IntSliderOption

      public IntSliderOption(String key, int initialValue, IntConsumer setter, IntFunction<net.minecraft.text.Text> valueToText, int min, int max, int step, net.minecraft.client.option.SimpleOption.TooltipFactory<Integer> tooltipFactory)
      Creates a slider option.
      Parameters:
      key - The translation key
      initialValue - The initial value
      setter - The callback for the modified value
      valueToText - The function that converts the value to human-readable text
      min - The minimum value
      max - The maximum value
      step - The step between each value
      tooltipFactory - The tooltip factory
    • IntSliderOption

      public IntSliderOption(String key, int initialValue, IntConsumer setter, IntFunction<net.minecraft.text.Text> valueToText, int min, int max, int step)
      Creates a slider option, with no tooltip.
      Parameters:
      key - The translation key
      initialValue - The initial value
      setter - The callback for the modified value
      valueToText - The function that converts the value to human-readable text
      min - The minimum value
      max - The maximum value
      step - The step between each value
    • IntSliderOption

      public IntSliderOption(String key, int initialValue, IntConsumer setter, IntFunction<net.minecraft.text.Text> valueToText, int min, int max)
      Creates a slider option, with no step or tooltip.
      Parameters:
      key - The translation key
      initialValue - The initial value
      setter - The callback for the modified value
      valueToText - The function that converts the value to human-readable text
      min - The minimum value
      max - The maximum 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