Class IVStore
java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.IVStore
- All Implemented Interfaces:
IStatStore
A Pokémon's IVs.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSet(BattleStatsType type, int value) Checks if the stat can be set to the valuevoidSets all unset IVs (value=-1) to 0.voidCopies IVs into another IV store.static IVStoreGenerates a new set of random IVs with three perfect IVs.static IVStoreGenerates a new set of random IVs for a new IVStore object.voidfillFromArray(int... ivs) Updates the IV values from the given arrayint[]getArray()Gets an array of the IVs in the store.boolean[]Gets an array of the hypertrained stats in the store.doublegetPercentage(int decimalPlaces) Gets the IV percentagegetPercentageString(int decimalPlaces) Gets the formatted percentage as a StringgetShorthand(String separator) intgetStat(BattleStatsType type) Gets the IVs for a stat.booleanbooleanCheck if the Pokémon's IVs are all Hyper Trained.booleanGets if a given stat is hyper trainedvoidMarks theEnumUpdateType.IVsandEnumUpdateType.Statsas dirty on the owner pokemonvoidSets all IVs to their maximum values.readFromByteBuffer(io.netty.buffer.ByteBuf buf) Reads the IVs from a byte buffervoidreadFromNBT(net.minecraft.nbt.CompoundTag nbt) Reads IVs from NBT.voidreset()Resets all the stats to 0voidsetHyperTrained(BattleStatsType stat, boolean hyperTrained) Sets a given stat to be hyper trained or not hyper trainedvoidSets the current IVStore object's IVs to new random values.voidsetStat(BattleStatsType type, int value) Sets the IVs for a stat.withPokemon(Pokemon pokemon) Sets the pokemon related to this IV StorevoidwriteToByteBuffer(io.netty.buffer.ByteBuf buf) Writes the IVs to a byte buffervoidwriteToNBT(net.minecraft.nbt.CompoundTag nbt) Writes the IVs to NBT.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pixelmonmod.pixelmon.api.pokemon.stats.IStatStore
addStat, getTotal, takeStat
-
Field Details
-
EMPTY
public static final int[] EMPTY -
MAX_IVS
public static final int MAX_IVS- See Also:
-
-
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:IStatStoreResets all the stats to 0- Specified by:
resetin interfaceIStatStore
-
withPokemon
Sets the pokemon related to this IV Store- Parameters:
pokemon- The new pokemon- Returns:
- This object
-
getStat
Gets the IVs for a stat.- Specified by:
getStatin interfaceIStatStore- Parameters:
type- The stat to get IVs for.- Returns:
- The IVs for the given stat.
-
setStat
Sets the IVs for a stat.- Specified by:
setStatin interfaceIStatStore- Parameters:
type- The stat to set IVs for.value- The value to set the IV to.
-
canSet
Description copied from interface:IStatStoreChecks if the stat can be set to the value- Specified by:
canSetin interfaceIStatStore- Parameters:
type- The type being setvalue- The value being set- Returns:
- If the stat can be set to the value
-
markDirty
public void markDirty()Marks theEnumUpdateType.IVsandEnumUpdateType.Statsas dirty on the owner pokemon -
createRandomNewIVs
Generates a new set of random IVs for a new IVStore object.- Returns:
- A new set of random IVs in a new IVStore object.
-
setIVsToRandomValues
public void setIVsToRandomValues()Sets the current IVStore object's IVs to new random values. -
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
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
Gets the formatted percentage as a String- Parameters:
decimalPlaces- The number of decimal places- Returns:
- Formatted percentage
-
getShorthand
-
copyIVs
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.
-
getHypertrainedArray
public boolean[] getHypertrainedArray()Gets an array of the hypertrained stats in the store.- Returns:
- An array of the hypertrained stats in the store.
-
maximizeIVs
public void maximizeIVs()Sets all IVs to their maximum values. -
setHyperTrained
Sets a given stat to be hyper trained or not hyper trained- Parameters:
stat- The stathyperTrained- if it is hyper trained or not
-
isHyperTrained
Gets if a given stat is hyper trained- Parameters:
stat- The stat- Returns:
- True if hyper trained
-
isEveryStatHyperTrained
public boolean isEveryStatHyperTrained()Check if the Pokémon's IVs are all Hyper Trained.- Returns:
- True if every IV is Hyper Trained. Returns false otherwise.
-
fillFromArray
public void fillFromArray(int... ivs) Updates the IV values from the given array- Parameters:
ivs- The new IV values
-