Class SliderOption
java.lang.Object
net.uku3lig.ukulib.config.option.SliderOption
- All Implemented Interfaces:
WidgetCreator
A
double option, displayed by a slider.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DoubleFunction<net.minecraft.network.chat.Component> Displays a double with 2 decimals of precision.static final DoubleFunction<net.minecraft.network.chat.Component> Displays a double as a rounded integer.static final DoubleFunction<net.minecraft.network.chat.Component> Displays a double as a percentage, with no further precision. -
Constructor Summary
ConstructorsConstructorDescriptionSliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText) Creates a slider option, between 0 (inclusive) and 1 (inclusive), with no step or tooltip.SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText, double min, double max) Creates a slider option, with no step or tooltip.SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText, double min, double max, double step) Creates a slider option, with no tooltip.SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText, double min, double max, double step, net.minecraft.client.OptionInstance.TooltipSupplier<@NotNull Double> tooltipSupplier) Creates a slider option. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.client.gui.components.AbstractWidgetcreateWidget(int x, int y, int width, int height) Creates the widget.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface WidgetCreator
createWidget, wide
-
Field Details
-
DEFAULT_VALUE_TO_TEXT
Displays a double with 2 decimals of precision. -
PERCENT_VALUE_TO_TEXT
Displays a double as a percentage, with no further precision. -
INTEGER_VALUE_TO_TEXT
Displays a double as a rounded integer.
-
-
Constructor Details
-
SliderOption
public SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText, double min, double max, double step, net.minecraft.client.OptionInstance.TooltipSupplier<@NotNull Double> tooltipSupplier) Creates a slider option.- Parameters:
key- The translation keyinitialValue- The initial valuesetter- The callback for the modified valuevalueToText- The function that converts the value to human-readable textmin- The minimum valuemax- The maximum valuestep- The step between each valuetooltipSupplier- The tooltip supplier
-
SliderOption
public SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText, double min, double max, double step) Creates a slider option, with no tooltip.- Parameters:
key- The translation keyinitialValue- The initial valuesetter- The callback for the modified valuevalueToText- The function that converts the value to human-readable textmin- The minimum valuemax- The maximum valuestep- The step between each value
-
SliderOption
public SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText, double min, double max) Creates a slider option, with no step or tooltip.- Parameters:
key- The translation keyinitialValue- The initial valuesetter- The callback for the modified valuevalueToText- The function that converts the value to human-readable textmin- The minimum valuemax- The maximum value
-
SliderOption
public SliderOption(String key, double initialValue, DoubleConsumer setter, DoubleFunction<net.minecraft.network.chat.Component> valueToText) Creates a slider option, between 0 (inclusive) and 1 (inclusive), with no step or tooltip.- Parameters:
key- The translation keyinitialValue- The initial valuesetter- The callback for the modified valuevalueToText- The function that converts the value to human-readable text
-
-
Method Details
-
createWidget
public net.minecraft.client.gui.components.AbstractWidget 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
-