Record Class GrowthData

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.pokemon.growth.GrowthData
Record Components:
mean - The mean size of the Pokemon
standardDeviation - The standard deviation of the Pokemon
minRenderScale - The minimum render scale of the Pokemon
maxRenderScale - The maximum render scale of the Pokemon

public record GrowthData(double mean, double standardDeviation, double minRenderScale, double maxRenderScale) extends Record
Represents the growth data of a Pokemon species.
This is used to determine the size of a Pokemon, and how it should be rendered.
This data is found in the Pokemon species JSON.
Since:
01/10/2024
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<GrowthData>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GrowthData(double mean, double standardDeviation, double minRenderScale, double maxRenderScale)
    Creates an instance of a GrowthData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static final GrowthData
    This method returns a basic growth data.
    final boolean
    Indicates whether some other object is "equal to" this one.
    double
    This method returns a random size generated along the normal distribution, using the mean() and standardDeviation().
    double
    getRenderScale(double size)
    This method returns the render scale of the size, clamped between the min and max render scales.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the maxRenderScale record component.
    double
    Returns the value of the mean record component.
    double
    Returns the value of the minRenderScale record component.
    double
    Returns the value of the standardDeviation record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • CODEC

      public static final com.mojang.serialization.Codec<GrowthData> CODEC
  • Constructor Details

    • GrowthData

      public GrowthData(double mean, double standardDeviation, double minRenderScale, double maxRenderScale)
      Creates an instance of a GrowthData record class.
      Parameters:
      mean - the value for the mean record component
      standardDeviation - the value for the standardDeviation record component
      minRenderScale - the value for the minRenderScale record component
      maxRenderScale - the value for the maxRenderScale record component
  • Method Details

    • getRenderScale

      public double getRenderScale(double size)
      This method returns the render scale of the size, clamped between the min and max render scales.
      This is calculated by subtracting the mean from the size and dividing by the standard deviation.
      Parameters:
      size - The size of the Pokemon
      Returns:
      The render scale of the size, clamped between the min and max render scales
    • getRandomSize

      public double getRandomSize()
      This method returns a random size generated along the normal distribution, using the mean() and standardDeviation().
      Returns:
      A random size generated along the normal distribution
    • basic

      public static final GrowthData basic()
      This method returns a basic growth data.
      This is mostly used for when a Pokemon species does not have growth data to fall back on.
      Returns:
      The basic growth data
    • 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 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 '=='.
      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 double mean()
      Returns the value of the mean record component.
      Returns:
      the value of the mean record component
    • standardDeviation

      public double standardDeviation()
      Returns the value of the standardDeviation record component.
      Returns:
      the value of the standardDeviation record component
    • minRenderScale

      public double minRenderScale()
      Returns the value of the minRenderScale record component.
      Returns:
      the value of the minRenderScale record component
    • maxRenderScale

      public double maxRenderScale()
      Returns the value of the maxRenderScale record component.
      Returns:
      the value of the maxRenderScale record component