Record Class ClampedNormalInt

java.lang.Object
java.lang.Record
net.minecraft.util.valueproviders.ClampedNormalInt
All Implemented Interfaces:
IntProvider

public record ClampedNormalInt(float mean, float deviation, int minInclusive, int maxInclusive) extends Record implements IntProvider
  • Field Summary

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

    Constructors
    Constructor
    Description
    ClampedNormalInt(float mean, float deviation, int minInclusive, int maxInclusive)
    Creates an instance of a ClampedNormalInt 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.
    int
    Returns the value of the maxInclusive record component.
    float
    Returns the value of the mean record component.
    int
    Returns the value of the minInclusive record component.
    of(float mean, float deviation, int minInclusive, int maxInclusive)
     
    int
     
    static int
    sample(RandomSource random, float mean, float deviation, float minInclusive, float maxInclusive)
     
    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.
    • minInclusive

      private final int minInclusive
      The field for the minInclusive record component.
    • maxInclusive

      private final int maxInclusive
      The field for the maxInclusive record component.
    • MAP_CODEC

      public static final MapCodec<ClampedNormalInt> MAP_CODEC
  • Constructor Details

    • ClampedNormalInt

      public ClampedNormalInt(float mean, float deviation, int minInclusive, int maxInclusive)
      Creates an instance of a ClampedNormalInt record class.
      Parameters:
      mean - the value for the mean record component
      deviation - the value for the deviation record component
      minInclusive - the value for the minInclusive record component
      maxInclusive - the value for the maxInclusive record component
  • Method Details

    • of

      public static ClampedNormalInt of(float mean, float deviation, int minInclusive, int maxInclusive)
    • sample

      public int sample(RandomSource random)
      Specified by:
      sample in interface IntProvider
    • sample

      public static int sample(RandomSource random, float mean, float deviation, float minInclusive, float maxInclusive)
    • codec

      public MapCodec<ClampedNormalInt> codec()
      Specified by:
      codec in interface IntProvider
    • 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
    • minInclusive

      public int minInclusive()
      Returns the value of the minInclusive record component.
      Specified by:
      minInclusive in interface IntProvider
      Returns:
      the value of the minInclusive record component
    • maxInclusive

      public int maxInclusive()
      Returns the value of the maxInclusive record component.
      Specified by:
      maxInclusive in interface IntProvider
      Returns:
      the value of the maxInclusive record component