Record Class ClampedNormalFloat

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

public record ClampedNormalFloat(float mean, float deviation, float min, float max) extends Record implements FloatProvider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final float
    The field for the deviation record component.
     
    private final float
    The field for the max record component.
    private final float
    The field for the mean record component.
    private final float
    The field for the min record component.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
     
    float
    Returns the value of the deviation record component.
    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
    Returns the value of the mean record component.
    float
    min()
    Returns the value of the min record component.
    of(float mean, float deviation, float min, float max)
     
    float
     
    static float
    sample(RandomSource random, float mean, float deviation, float min, float max)
     
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • mean

      private final float mean
      The field for the mean record component.
    • deviation

      private final float deviation
      The field for the deviation record component.
    • 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<ClampedNormalFloat> MAP_CODEC
  • Constructor Details

    • ClampedNormalFloat

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

    • of

      public static ClampedNormalFloat of(float mean, float deviation, float min, float max)
    • sample

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

      public static float sample(RandomSource random, float mean, float deviation, float min, float max)
    • codec

      public MapCodec<ClampedNormalFloat> 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.
    • mean

      public float mean()
      Returns the value of the mean record component.
      Returns:
      the value of the mean record component
    • deviation

      public float deviation()
      Returns the value of the deviation record component.
      Returns:
      the value of the deviation record component
    • 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