java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.IVStore
All Implemented Interfaces:
IStatStore

public class IVStore extends Object implements IStatStore
A Pokémon's IVs.
  • Field Details

  • Constructor Details

    • IVStore

      public IVStore()
      Initializes an IV store with 0 IVs.
    • IVStore

      public IVStore(int... ivs)
      Initializes an IV store.
      Parameters:
      ivs - The IVs to initializes the IV store to.
  • Method Details

    • reset

      public void reset()
      Description copied from interface: IStatStore
      Resets all the stats to 0
      Specified by:
      reset in interface IStatStore
    • withPokemon

      public IVStore withPokemon(Pokemon pokemon)
      Sets the pokemon related to this IV Store
      Parameters:
      pokemon - The new pokemon
      Returns:
      This object
    • getStat

      public int getStat(BattleStatsType type)
      Gets the IVs for a stat.
      Specified by:
      getStat in interface IStatStore
      Parameters:
      type - The stat to get IVs for.
      Returns:
      The IVs for the given stat.
    • setStat

      public void setStat(BattleStatsType type, int value)
      Sets the IVs for a stat.
      Specified by:
      setStat in interface IStatStore
      Parameters:
      type - The stat to set IVs for.
      value - The value to set the IV to.
    • canSet

      public boolean canSet(BattleStatsType type, int value)
      Description copied from interface: IStatStore
      Checks if the stat can be set to the value
      Specified by:
      canSet in interface IStatStore
      Parameters:
      type - The type being set
      value - The value being set
      Returns:
      If the stat can be set to the value
    • markDirty

      public void markDirty()
      Marks the EnumUpdateType.IVs and EnumUpdateType.Stats as dirty on the owner pokemon
    • createRandomNewIVs

      public static IVStore createRandomNewIVs()
      Generates a new set of random IVs.
      Returns:
      A new set of random IVs.
    • createNewIVs3Perfect

      public static IVStore createNewIVs3Perfect()
      Generates a new set of random IVs with three perfect IVs.
      Returns:
      A new set of random IVs with three perfect IVs.
    • hasAnyIVBeenSet

      public boolean hasAnyIVBeenSet()
      Returns:
      Whether any of the IVs has been set.
    • clearUnsetIVs

      public void clearUnsetIVs()
      Sets all unset IVs (value=-1) to 0.
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag nbt)
      Writes the IVs to NBT.
      Parameters:
      nbt - The NBT tag to write to.
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag nbt)
      Reads IVs from NBT.
      Parameters:
      nbt - The NBT tag to read from.
    • writeToByteBuffer

      public void writeToByteBuffer(io.netty.buffer.ByteBuf buf)
      Writes the IVs to a byte buffer
      Parameters:
      buf - The byte buffer
    • readFromByteBuffer

      public IVStore readFromByteBuffer(io.netty.buffer.ByteBuf buf)
      Reads the IVs from a byte buffer
      Parameters:
      buf - The byte buffer
      Returns:
      The IVs
    • getPercentage

      public double getPercentage(int decimalPlaces)
      Gets the IV percentage
      Parameters:
      decimalPlaces - The number of decimals to include in the percentage
      Returns:
      The percentage
    • getPercentageString

      public String getPercentageString(int decimalPlaces)
      Gets the formatted percentage as a String
      Parameters:
      decimalPlaces - The number of decimal places
      Returns:
      Formatted percentage
    • getShorthand

      public String getShorthand(String separator)
    • copyIVs

      public void copyIVs(IVStore ivs)
      Copies IVs into another IV store.
      Parameters:
      ivs - The IV store to copy to.
    • getArray

      public int[] getArray()
      Gets an array of the IVs in the store.
      Returns:
      An array of the IVs in the store.
    • maximizeIVs

      public void maximizeIVs()
      Sets all IVs to their maximum values.
    • setHyperTrained

      public void setHyperTrained(BattleStatsType stat, boolean hyperTrained)
      Sets a given stat to be hyper trained or not hyper trained
      Parameters:
      stat - The stat
      hyperTrained - if it is hyper trained or not
    • isHyperTrained

      public boolean isHyperTrained(BattleStatsType stat)
      Gets if a given stat is hyper trained
      Parameters:
      stat - The stat
      Returns:
      True if hyper trained
    • fillFromArray

      public void fillFromArray(int... ivs)
      Updates the IV values from the given array
      Parameters:
      ivs - The new IV values