Record Class Growth

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.pokemon.growth.Growth
Record Components:
range - The size range of this growth
sprite - The sprite to use for this size in the UI

public record Growth(GrowthComparator range, ResourceWithFallback sprite) extends Record
Represents a range of sizes that a Pokemon can be.
This is used to represent the size in the Pokedex and other UIs.
The range of sizes is represented by a number of standard deviations from the mean size of the Pokemon, with the mean and standard deviation being determined by the Pokemon's species JSON.
All Growths from the registry are synced to the client from the server on login using the CODEC so that the client can display the correct size in the UI. range
Since:
01/10/2024
  • Field Details

    • CODEC

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

    • Growth

      public Growth(GrowthComparator range, ResourceWithFallback sprite)
      Creates an instance of a Growth record class.
      Parameters:
      range - the value for the range record component
      sprite - the value for the sprite record component
  • Method Details

    • getName

      public net.minecraft.network.chat.Component getName()
      Gets the name of this size.
      This is used in the Pokedex and other UIs.
      Returns:
      The name of this size
    • inRange

      public boolean inRange(Pokemon pokemon)
      Checks if the given Pokemon is in range of this size.
      Parameters:
      pokemon - The Pokemon to check
      Returns:
      If the given Pokemon is in range of this size
    • random

      public double random(Pokemon pokemon)
      Gets a random size for the given Pokemon.
      Parameters:
      pokemon - The Pokemon to get the size for
      Returns:
      A random size for the given Pokemon
    • 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 Objects::equals(Object,Object).
      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.
    • range

      public GrowthComparator range()
      Returns the value of the range record component.
      Returns:
      the value of the range record component
    • sprite

      public ResourceWithFallback sprite()
      Returns the value of the sprite record component.
      Returns:
      the value of the sprite record component