Class IVStore
java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.IVStore
- All Implemented Interfaces:
IStatStore
A Pokémon's IVs.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canSet
(BattleStatsType type, int value) Checks if the stat can be set to the valuevoid
Sets all unset IVs (value=-1) to 0.void
Copies IVs into another IV store.static IVStore
Generates a new set of random IVs with three perfect IVs.static IVStore
Generates a new set of random IVs for a new IVStore object.void
fillFromArray
(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.double
getPercentage
(int decimalPlaces) Gets the IV percentagegetPercentageString
(int decimalPlaces) Gets the formatted percentage as a StringgetShorthand
(String separator) int
getStat
(BattleStatsType type) Gets the IVs for a stat.boolean
boolean
Check if the Pokémon's IVs are all Hyper Trained.boolean
Gets if a given stat is hyper trainedvoid
Marks theEnumUpdateType.IVs
andEnumUpdateType.Stats
as dirty on the owner pokemonvoid
Sets all IVs to their maximum values.readFromByteBuffer
(io.netty.buffer.ByteBuf buf) Reads the IVs from a byte buffervoid
readFromNBT
(net.minecraft.nbt.CompoundTag nbt) Reads IVs from NBT.void
reset()
Resets all the stats to 0void
setHyperTrained
(BattleStatsType stat, boolean hyperTrained) Sets a given stat to be hyper trained or not hyper trainedvoid
Sets the current IVStore object's IVs to new random values.void
setStat
(BattleStatsType type, int value) Sets the IVs for a stat.withPokemon
(Pokemon pokemon) Sets the pokemon related to this IV Storevoid
writeToByteBuffer
(io.netty.buffer.ByteBuf buf) Writes the IVs to a byte buffervoid
writeToNBT
(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, wait
Methods 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:IStatStore
Resets all the stats to 0- Specified by:
reset
in 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:
getStat
in 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:
setStat
in interfaceIStatStore
- Parameters:
type
- The stat to set IVs for.value
- The value to set the IV to.
-
canSet
Description copied from interface:IStatStore
Checks if the stat can be set to the value- Specified by:
canSet
in 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.IVs
andEnumUpdateType.Stats
as 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
-