CLASS net/minecraft/class_7172 net/minecraft/client/option/SimpleOption COMMENT A class representing an option of a client. Exactly one instance of this class COMMENT should be created per option. See below for how to create an instance. COMMENT COMMENT
This class allows querying and storing of the option value via {@link #getValue()} COMMENT and {@link #setValue(Object)} respectively. Option values are automatically validated, COMMENT and if the value is invalid, the value resets back to the default. Some validators will COMMENT coerce the invalid value (e.g. by clamping) into a valid one instead of failing; in this COMMENT case the new value is used. COMMENT COMMENT
Option values are serialized using codecs. Check DataFixerUpper code for the list of COMMENT available codecs. For serialization of enums, you can check the code in {@link GameOptions}. COMMENT COMMENT
If the value has changed, the {@code changeCallback} passed to the constructor will COMMENT trigger with the new value. COMMENT COMMENT
This class itself cannot be extended by default; instead, the behavior of the option, COMMENT such as validation or rendering of the {@link ClickableWidget} associated with the COMMENT option, is customized by passing a {@link SimpleOption.Callbacks} instance. There are COMMENT several existing callbacks that should cover most of the needs: COMMENT COMMENT
See also several {@code ofBoolean} methods for options using boolean values. COMMENT COMMENT
Slider option callbacks allow "modifiers" to be applied. The "slider progress value" COMMENT is the value used to calculate the slider's progress and must be linear. The real value, COMMENT simply called "value" in {@code withModifier} methods, is the value used in COMMENT {@link #getValue()} and passed to {@link #textGetter}. COMMENT COMMENT
The behavior for invalid {@code value} varies; the validator can either coerce COMMENT the passed value into a valid one by clamping etc, or fail the validation and reset to COMMENT the default value. COMMENT COMMENT
If the new value differs from the new value, {@link #changeCallback} will trigger.
ARG 1 value
METHOD method_41749 ofBoolean (Ljava/lang/String;Lnet/minecraft/class_7172$class_7277;Z)Lnet/minecraft/class_7172;
COMMENT Creates a boolean option.
ARG 0 key
ARG 1 tooltipFactory
ARG 2 defaultValue
METHOD method_41750 ofBoolean (Ljava/lang/String;Lnet/minecraft/class_7172$class_7277;ZLjava/util/function/Consumer;)Lnet/minecraft/class_7172;
COMMENT Creates a boolean option.
ARG 0 key
ARG 1 tooltipFactory
ARG 2 defaultValue
ARG 3 changeCallback
METHOD method_41751 ofBoolean (Ljava/lang/String;ZLjava/util/function/Consumer;)Lnet/minecraft/class_7172;
COMMENT Creates a boolean option.
ARG 0 key
ARG 1 defaultValue
ARG 2 changeCallback
METHOD method_41752 (Ljava/lang/Boolean;)V
ARG 0 value
METHOD method_41753 getValue ()Ljava/lang/Object;
COMMENT {@return the option's current value}
METHOD method_41754 getCallbacks ()Lnet/minecraft/class_7172$class_7178;
METHOD method_42399 emptyTooltip ()Lnet/minecraft/class_7172$class_7277;
COMMENT {@return the getter for the {@code tooltipFactoryGetter} parameter of the constructor
COMMENT to indicate empty tooltips}
METHOD method_42402 ofBoolean (Ljava/lang/String;Z)Lnet/minecraft/class_7172;
COMMENT Creates a boolean option.
ARG 0 key
ARG 1 defaultValue
METHOD method_42404 getCodec ()Lcom/mojang/serialization/Codec;
METHOD method_42405 (Ljava/lang/Boolean;)V
ARG 0 value
METHOD method_42715 (Lnet/minecraft/class_7172$class_7303;Ljava/lang/Object;)Lnet/minecraft/class_2561;
ARG 2 value
METHOD method_42717 constantTooltip (Lnet/minecraft/class_2561;)Lnet/minecraft/class_7172$class_7277;
COMMENT {@return the getter for the {@code tooltipFactoryGetter} parameter of the constructor
COMMENT to indicate constant tooltips}
ARG 0 text
METHOD method_42718 (Lnet/minecraft/class_2561;Lnet/minecraft/class_7291;)Lnet/minecraft/class_2561;
ARG 0 optionText
ARG 1 value
METHOD method_42720 enumValueText ()Lnet/minecraft/class_7172$class_7303;
COMMENT {@return the getter for the {@code valueTextGetter} parameter of the constructor
COMMENT to use the value's text as the option's rendered text}
COMMENT
COMMENT @apiNote This requires the value to be an enum implementing {@link TranslatableOption}.
METHOD method_47393 (Lnet/minecraft/class_2561;Ljava/lang/Object;)Lnet/minecraft/class_7919;
ARG 1 value
METHOD method_47394 (Ljava/lang/Object;)Lnet/minecraft/class_7919;
ARG 0 value
METHOD method_47603 createWidget (Lnet/minecraft/class_315;IIILjava/util/function/Consumer;)Lnet/minecraft/class_339;
ARG 1 options
ARG 2 x
ARG 3 y
ARG 4 width
ARG 5 changeCallback
METHOD method_47604 ofBoolean (Ljava/lang/String;Lnet/minecraft/class_7172$class_7277;Lnet/minecraft/class_7172$class_7303;ZLjava/util/function/Consumer;)Lnet/minecraft/class_7172;
ARG 0 key
ARG 1 tooltipFactory
ARG 2 valueTextGetter
ARG 3 defaultValue
ARG 4 changeCallback
METHOD method_47605 (Lnet/minecraft/class_2561;Ljava/lang/Boolean;)Lnet/minecraft/class_2561;
ARG 0 optionText
ARG 1 value
METHOD method_47606 (Ljava/lang/Object;)V
ARG 0 value
METHOD method_57701 createWidget (Lnet/minecraft/class_315;)Lnet/minecraft/class_339;
ARG 1 options
CLASS class_7173 PotentialValuesBasedCallbacks
COMMENT A set of callbacks for a cycling option.
COMMENT
COMMENT @see Callbacks
CLASS class_7174 ValidatingIntSliderCallbacks
COMMENT A set of callbacks for a slider of integer values with a fixed minimum and maximum values.
COMMENT
COMMENT @see Callbacks
CLASS class_7175 OptionSliderWidgetImpl
FIELD field_37872 option Lnet/minecraft/class_7172;
FIELD field_37873 callbacks Lnet/minecraft/class_7172$class_7176;
FIELD field_37874 tooltipFactory Lnet/minecraft/class_7172$class_7277;
FIELD field_41334 changeCallback Ljava/util/function/Consumer;
METHOD Widget creators are responsible for rendering the option into
COMMENT a {@link ClickableWidget}.
ARG 1 tooltipFactory
ARG 2 gameOptions
ARG 3 x
ARG 4 y
ARG 5 width
ARG 6 changeCallback
METHOD method_41758 validate (Ljava/lang/Object;)Ljava/util/Optional;
COMMENT {@return the validated value}
COMMENT
COMMENT Returning {@link Optional#empty()} indicates the passed value is invalid and it
COMMENT should reset to the default value. This method can also coerce the invalid value
COMMENT into a valid one by clamping, etc.
ARG 1 value
CLASS class_7273 AlternateValuesSupportingCyclingCallbacks
COMMENT A set of callbacks for a cycling option with alternate potential values that are used
COMMENT only when certain conditions are met.
COMMENT
COMMENT @see Callbacks
CLASS class_7275 IntSliderCallbacks
METHOD method_42414 withModifier (Ljava/util/function/IntFunction;Ljava/util/function/ToIntFunction;)Lnet/minecraft/class_7172$class_7176;
COMMENT Creates a slider callback with the modifier applied. Note that when using this,
COMMENT {@link SimpleOption.IntSliderCallbacks} must be constructed using the slider progress
COMMENT value; the modifier is applied to that callbacks.
COMMENT
COMMENT @see Callback Modifiers
ARG 1 sliderProgressValueToValue
ARG 2 valueToSliderProgressValue
CLASS 1
CLASS class_7276 LazyCyclingCallbacks
COMMENT A set of callbacks for a cycling option whose potential values are determined lazily.
COMMENT
COMMENT @see Callbacks
CLASS class_7277 TooltipFactory
METHOD apply (Ljava/lang/Object;)Lnet/minecraft/class_7919;
ARG 1 value
CLASS class_7303 ValueTextGetter
METHOD toString (Lnet/minecraft/class_2561;Ljava/lang/Object;)Lnet/minecraft/class_2561;
ARG 1 optionText
ARG 2 value
CLASS class_7304 MaxSuppliableIntCallbacks
COMMENT A set of callbacks for a cycling option with a fixed minimum value and a dynamic
COMMENT maximum value. This clamps the value during validation.
COMMENT
COMMENT @see Callbacks
METHOD method_42409 (Ljava/lang/Integer;)Lcom/mojang/serialization/DataResult;
ARG 1 value
CLASS class_7305 CyclingCallbacks
METHOD method_42721 getValues ()Lnet/minecraft/class_5676$class_5680;
METHOD method_42723 (Lnet/minecraft/class_7172$class_7277;IIILnet/minecraft/class_315;Ljava/util/function/Consumer;Lnet/minecraft/class_7172;)Lnet/minecraft/class_339;
ARG 7 option
METHOD method_42724 (Lnet/minecraft/class_7172;Lnet/minecraft/class_315;Ljava/util/function/Consumer;Lnet/minecraft/class_5676;Ljava/lang/Object;)V
ARG 4 button
ARG 5 value
CLASS class_7274 ValueSetter
METHOD set (Lnet/minecraft/class_7172;Ljava/lang/Object;)V
ARG 1 option
ARG 2 value
CLASS class_7306 TypeChangeableCallbacks
METHOD method_42722 isCycling ()Z