Record Class GrowthData
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.pokemon.growth.GrowthData
- Record Components:
mean- The mean size of the PokemonstandardDeviation- The standard deviation of the PokemonminRenderScale- The minimum render scale of the PokemonmaxRenderScale- 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.
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 -
Constructor Summary
ConstructorsConstructorDescriptionGrowthData(double mean, double standardDeviation, double minRenderScale, double maxRenderScale) Creates an instance of aGrowthDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic final GrowthDatabasic()This method returns a basic growth data.final booleanIndicates whether some other object is "equal to" this one.doubleThis method returns a random size generated along the normal distribution, using themean()andstandardDeviation().doublegetRenderScale(double size) This method returns the render scale of the size, clamped between the min and max render scales.final inthashCode()Returns a hash code value for this object.doubleReturns the value of themaxRenderScalerecord component.doublemean()Returns the value of themeanrecord component.doubleReturns the value of theminRenderScalerecord component.doubleReturns the value of thestandardDeviationrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
GrowthData
public GrowthData(double mean, double standardDeviation, double minRenderScale, double maxRenderScale) Creates an instance of aGrowthDatarecord class.- Parameters:
mean- the value for themeanrecord componentstandardDeviation- the value for thestandardDeviationrecord componentminRenderScale- the value for theminRenderScalerecord componentmaxRenderScale- the value for themaxRenderScalerecord 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 themean()andstandardDeviation().- Returns:
- A random size generated along the normal distribution
-
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
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. -
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. -
equals
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 '=='. -
mean
public double mean()Returns the value of themeanrecord component.- Returns:
- the value of the
meanrecord component
-
standardDeviation
public double standardDeviation()Returns the value of thestandardDeviationrecord component.- Returns:
- the value of the
standardDeviationrecord component
-
minRenderScale
public double minRenderScale()Returns the value of theminRenderScalerecord component.- Returns:
- the value of the
minRenderScalerecord component
-
maxRenderScale
public double maxRenderScale()Returns the value of themaxRenderScalerecord component.- Returns:
- the value of the
maxRenderScalerecord component
-