Record Class UniformFloat

java.lang.Object
java.lang.Record
net.minecraft.util.valueproviders.UniformFloat
All Implemented Interfaces:
FloatProvider, SampledFloat

public record UniformFloat(float min, float max) extends Record implements FloatProvider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final MapCodec<UniformFloat>
     
    private final float
    The field for the max record component.
    private final float
    The field for the min record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UniformFloat(float min, float max)
    Creates an instance of a UniformFloat record class.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    float
    max()
    Returns the value of the max record component.
    float
    min()
    Returns the value of the min record component.
    of(float min, float max)
     
    float
     
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • min

      private final float min
      The field for the min record component.
    • max

      private final float max
      The field for the max record component.
    • MAP_CODEC

      public static final MapCodec<UniformFloat> MAP_CODEC
  • Constructor Details

    • UniformFloat

      public UniformFloat(float min, float max)
      Creates an instance of a UniformFloat record class.
      Parameters:
      min - the value for the min record component
      max - the value for the max record component
  • Method Details

    • of

      public static UniformFloat of(float min, float max)
    • sample

      public float sample(RandomSource random)
      Specified by:
      sample in interface SampledFloat
    • codec

      public MapCodec<UniformFloat> codec()
      Specified by:
      codec in interface FloatProvider
    • toString

      public 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 o)
      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 the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • min

      public float min()
      Returns the value of the min record component.
      Specified by:
      min in interface FloatProvider
      Returns:
      the value of the min record component
    • max

      public float max()
      Returns the value of the max record component.
      Specified by:
      max in interface FloatProvider
      Returns:
      the value of the max record component