Record Class SimpleOption.CategoricalSliderCallbacks<T>

java.lang.Object
java.lang.Record
net.minecraft.client.option.SimpleOption.CategoricalSliderCallbacks<T>
Record Components:
values -
codec -
All Implemented Interfaces:
SimpleOption.Callbacks<T>, SimpleOption.SliderCallbacks<T>
Enclosing class:
SimpleOption<T>

@Environment(CLIENT) public static record SimpleOption.CategoricalSliderCallbacks<T>(List<T> values, com.mojang.serialization.Codec<T> codec) extends Record implements SimpleOption.SliderCallbacks<T>
Mappings:
Namespace Name
named net/minecraft/client/option/SimpleOption$CategoricalSliderCallbacks
intermediary net/minecraft/class_7172$class_12139
official gda$j
named values
intermediary comp_5052
official a
named codec
intermediary comp_675
official b
  • Field Details

    • values

      private final List<T> values
      The field for the values record component.
    • codec

      private final com.mojang.serialization.Codec<T> codec
      The field for the codec record component.
  • Constructor Details

    • CategoricalSliderCallbacks

      public CategoricalSliderCallbacks(List<T> values, com.mojang.serialization.Codec<T> codec)
      Creates an instance of a CategoricalSliderCallbacks record class.
      Parameters:
      values - the value for the values record component
      codec - the value for the codec record component
  • Method Details

    • toSliderProgress

      public double toSliderProgress(T value)
      Returns the progress (0.0 to 1.0, both inclusive) of the slider.
      Specified by:
      toSliderProgress in interface SimpleOption.SliderCallbacks<T>
      Returns:
      the progress (0.0 to 1.0, both inclusive) of the slider
      Mappings:
      Namespace Name Mixin selector
      named toSliderProgress Lnet/minecraft/client/option/SimpleOption$SliderCallbacks;toSliderProgress(Ljava/lang/Object;)D
      intermediary method_41765 Lnet/minecraft/class_7172$class_7176;method_41765(Ljava/lang/Object;)D
      official d Lgda$l;d(Ljava/lang/Object;)D
    • getNext

      public Optional<T> getNext(T value)
      Specified by:
      getNext in interface SimpleOption.SliderCallbacks<T>
      Mappings:
      Namespace Name Mixin selector
      named getNext Lnet/minecraft/client/option/SimpleOption$SliderCallbacks;getNext(Ljava/lang/Object;)Ljava/util/Optional;
      intermediary method_75313 Lnet/minecraft/class_7172$class_7176;method_75313(Ljava/lang/Object;)Ljava/util/Optional;
      official c Lgda$l;c(Ljava/lang/Object;)Ljava/util/Optional;
    • getPrevious

      public Optional<T> getPrevious(T value)
      Specified by:
      getPrevious in interface SimpleOption.SliderCallbacks<T>
      Mappings:
      Namespace Name Mixin selector
      named getPrevious Lnet/minecraft/client/option/SimpleOption$SliderCallbacks;getPrevious(Ljava/lang/Object;)Ljava/util/Optional;
      intermediary method_75311 Lnet/minecraft/class_7172$class_7176;method_75311(Ljava/lang/Object;)Ljava/util/Optional;
      official b Lgda$l;b(Ljava/lang/Object;)Ljava/util/Optional;
    • toValue

      public T toValue(double sliderProgress)
      Returns the value from the progress (0.0 to 1.0, both inclusive) of the slider.
      Specified by:
      toValue in interface SimpleOption.SliderCallbacks<T>
      Returns:
      the value from the progress (0.0 to 1.0, both inclusive) of the slider
      Mappings:
      Namespace Name Mixin selector
      named toValue Lnet/minecraft/client/option/SimpleOption$SliderCallbacks;toValue(D)Ljava/lang/Object;
      intermediary method_41763 Lnet/minecraft/class_7172$class_7176;method_41763(D)Ljava/lang/Object;
      official b Lgda$l;b(D)Ljava/lang/Object;
    • validate

      public Optional<T> validate(T value)
      Returns the validated value.

      Returning Optional.empty() indicates the passed value is invalid and it should reset to the default value. This method can also coerce the invalid value into a valid one by clamping, etc.

      Specified by:
      validate in interface SimpleOption.Callbacks<T>
      Returns:
      the validated value
      Mappings:
      Namespace Name Mixin selector
      named validate Lnet/minecraft/client/option/SimpleOption$Callbacks;validate(Ljava/lang/Object;)Ljava/util/Optional;
      intermediary method_41758 Lnet/minecraft/class_7172$class_7178;method_41758(Ljava/lang/Object;)Ljava/util/Optional;
      official a Lgda$o;a(Ljava/lang/Object;)Ljava/util/Optional;
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • values

      public List<T> values()
      Returns the value of the values record component.
      Returns:
      the value of the values record component
    • codec

      public com.mojang.serialization.Codec<T> codec()
      Returns the value of the codec record component.
      Specified by:
      codec in interface SimpleOption.Callbacks<T>
      Returns:
      the value of the codec record component