public class IVStore extends java.lang.Object implements IStatStore
Modifier and Type | Field and Description |
---|---|
static int |
MAX_IVS |
Constructor and Description |
---|
IVStore()
Initializes an IV store with 0 IVs.
|
IVStore(int... ivs)
Initializes an IV store.
|
Modifier and Type | Method and Description |
---|---|
void |
copyIVs(IVStore ivs)
Copies IVs into another IV store.
|
static IVStore |
createNewIVs3Perfect()
Generates a new set of random IVs with three perfect IVs.
|
static IVStore |
createRandomNewIVs()
Generates a new set of random IVs.
|
void |
fillFromArray(int... ivs)
Updates the IV values from the given array
|
int[] |
getArray()
Gets an array of the IVs in the store.
|
double |
getPercentage(int decimalPlaces)
Gets the IV percentage
|
java.lang.String |
getPercentageString(int decimalPlaces)
Gets the formatted percentage as a String
|
java.lang.String |
getShorthand(java.lang.String separator) |
int |
getStat(BattleStatsType type)
Gets the IVs for a stat.
|
boolean |
isHyperTrained(BattleStatsType stat)
Gets if a given stat is hyper trained
|
void |
markDirty()
Marks the
EnumUpdateType.IVs and EnumUpdateType.Stats as dirty on the owner pokemon |
void |
maximizeIVs()
Sets all IVs to their maximum values.
|
IVStore |
readFromByteBuffer(io.netty.buffer.ByteBuf buf)
Reads the IVs from a byte buffer
|
void |
readFromNBT(net.minecraft.nbt.CompoundNBT nbt)
Reads IVs from NBT.
|
void |
setHyperTrained(BattleStatsType stat,
boolean hyperTrained)
Sets a given stat to be hyper trained or not hyper trained
|
void |
setStat(BattleStatsType type,
int value)
Sets the IVs for a stat.
|
IVStore |
withPokemon(Pokemon pokemon)
Sets the pokemon related to this IV Store
|
void |
writeToByteBuffer(io.netty.buffer.ByteBuf buf)
Writes the IVs to a byte buffer
|
void |
writeToNBT(net.minecraft.nbt.CompoundNBT nbt)
Writes the IVs to NBT.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStat, getTotal, takeStat
public static final int MAX_IVS
public IVStore()
public IVStore(int... ivs)
ivs
- The IVs to initializes the IV store to.public IVStore withPokemon(Pokemon pokemon)
pokemon
- The new pokemonpublic int getStat(BattleStatsType type)
getStat
in interface IStatStore
type
- The stat to get IVs for.public void setStat(BattleStatsType type, int value)
setStat
in interface IStatStore
type
- The stat to set IVs for.value
- The value to set the IV to.public void markDirty()
EnumUpdateType.IVs
and EnumUpdateType.Stats
as dirty on the owner pokemonpublic static IVStore createRandomNewIVs()
public static IVStore createNewIVs3Perfect()
public void writeToNBT(net.minecraft.nbt.CompoundNBT nbt)
nbt
- The NBT tag to write to.public void readFromNBT(net.minecraft.nbt.CompoundNBT nbt)
nbt
- The NBT tag to read from.public void writeToByteBuffer(io.netty.buffer.ByteBuf buf)
buf
- The byte bufferpublic IVStore readFromByteBuffer(io.netty.buffer.ByteBuf buf)
buf
- The byte bufferpublic double getPercentage(int decimalPlaces)
decimalPlaces
- The number of decimals to include in the percentagepublic java.lang.String getPercentageString(int decimalPlaces)
decimalPlaces
- The number of decimal placespublic java.lang.String getShorthand(java.lang.String separator)
public void copyIVs(IVStore ivs)
ivs
- The IV store to copy to.public int[] getArray()
public void maximizeIVs()
public void setHyperTrained(BattleStatsType stat, boolean hyperTrained)
stat
- The stathyperTrained
- if it is hyper trained or notpublic boolean isHyperTrained(BattleStatsType stat)
stat
- The statpublic void fillFromArray(int... ivs)
ivs
- The new IV values