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
-
Constructor Summary
ConstructorDescriptionGrowthData
(double mean, double standardDeviation, double minRenderScale, double maxRenderScale) Creates an instance of aGrowthData
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic final GrowthData
basic()
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 themean()
andstandardDeviation()
.double
getRenderScale
(double size) This method returns the render scale of the size, clamped between the min and max render scales.final int
hashCode()
Returns a hash code value for this object.double
Returns the value of themaxRenderScale
record component.double
mean()
Returns the value of themean
record component.double
Returns the value of theminRenderScale
record component.double
Returns the value of thestandardDeviation
record component.final String
toString()
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 aGrowthData
record class.- Parameters:
mean
- the value for themean
record componentstandardDeviation
- the value for thestandardDeviation
record componentminRenderScale
- the value for theminRenderScale
record componentmaxRenderScale
- the value for themaxRenderScale
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 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 themean
record component.- Returns:
- the value of the
mean
record component
-
standardDeviation
public double standardDeviation()Returns the value of thestandardDeviation
record component.- Returns:
- the value of the
standardDeviation
record component
-
minRenderScale
public double minRenderScale()Returns the value of theminRenderScale
record component.- Returns:
- the value of the
minRenderScale
record component
-
maxRenderScale
public double maxRenderScale()Returns the value of themaxRenderScale
record component.- Returns:
- the value of the
maxRenderScale
record component
-