Class PokemonLevel
java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.PokemonLevel
- Direct Known Subclasses:
TempBattlePokemonLevel
A Pokémon's pokemonLevel.
-
Field Summary
Modifier and TypeFieldDescriptionint
The experience remaining until the next pokemonLevel.protected ExperienceGainType
The type of experience that gave the last level.protected DelegateLink
The Pokémon who has this pokemonLevel. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
awardEXP
(int experience) void
awardEXP
(int experience, ExperienceGainType type) void
awardEXP
(BattleController controller, int experience, ExperienceGainType type) Awards experience to the Pokémon.boolean
Checks if the Pokémon can pokemonLevel up.int
getExp()
Gets the amount of experience the Pokémon has.int
getExpForLevel
(int level) int
float
Gets the fractional progress of experience to the Pokémon's next pokemonLevel.static float
getExpFraction
(int exp, int expToNextLevel) Gets the fractional progress of experience to the Pokémon's next pokemonLevel.Returns the type of xp the last level-up used.int
Gets the Pokémon's pokemonLevel.protected void
onLevelUp
(PixelmonStatsData stats) Updates the Pokémon's stats upon leveling up.void
readFromNBT
(net.minecraft.nbt.CompoundTag var1) Reads the Pokémon's pokemonLevel from NBT.void
Resets the Pokémon experience to the beginning of the pokemonLevel.void
setExp
(int experience) Sets the Pokémon's experience.void
setLevel
(int i) Sets the Pokémon's pokemonLevel and updates its health proportionally.void
Updates the amount of experience between the current and next levels.protected void
Updates a Pokémon's stats client-side.void
writeToNBT
(net.minecraft.nbt.CompoundTag var1) Saves the Pokémon's pokemonLevel to NBT.
-
Field Details
-
pixelmon
The Pokémon who has this pokemonLevel. -
lastLevelType
The type of experience that gave the last level. -
expToNextLevel
public int expToNextLevelThe experience remaining until the next pokemonLevel.
-
-
Constructor Details
-
PokemonLevel
Initializes a pokemonLevel.- Parameters:
p
- The Pokémon who has this pokemonLevel.
-
-
Method Details
-
updateStats
protected void updateStats()Updates a Pokémon's stats client-side. -
writeToNBT
public void writeToNBT(net.minecraft.nbt.CompoundTag var1) Saves the Pokémon's pokemonLevel to NBT.- Parameters:
var1
- The NBT tag to write to.
-
readFromNBT
public void readFromNBT(net.minecraft.nbt.CompoundTag var1) Reads the Pokémon's pokemonLevel from NBT.- Parameters:
var1
- The NBT tag to read from.
-
getPokemonLevel
public int getPokemonLevel()Gets the Pokémon's pokemonLevel.- Returns:
- The Pokémon's pokemonLevel.
-
setLevel
public void setLevel(int i) Sets the Pokémon's pokemonLevel and updates its health proportionally.- Parameters:
i
- The new pokemonLevel.
-
getLastLevelType
Returns the type of xp the last level-up used. -
updateExpToNextLevel
public void updateExpToNextLevel()Updates the amount of experience between the current and next levels. -
getExp
public int getExp()Gets the amount of experience the Pokémon has.- Returns:
- The amount of experience the Pokémon has
-
setExp
public void setExp(int experience) Sets the Pokémon's experience.- Parameters:
experience
- The Pokémon's experience.
-
canLevelUp
public boolean canLevelUp()Checks if the Pokémon can pokemonLevel up.- Returns:
- Whether the Pokémon can pokemonLevel up.
-
onLevelUp
Updates the Pokémon's stats upon leveling up.- Parameters:
stats
- The stats to update.
-
awardEXP
public void awardEXP(int experience) - See Also:
-
awardEXP
-
awardEXP
public void awardEXP(@Nullable BattleController controller, int experience, ExperienceGainType type) Awards experience to the Pokémon.- Parameters:
experience
- The amount of experience to award.
-
recalculateXP
public void recalculateXP()Resets the Pokémon experience to the beginning of the pokemonLevel. -
getExpFraction
public float getExpFraction()Gets the fractional progress of experience to the Pokémon's next pokemonLevel.- Returns:
- The fractional progress of experience to the Pokémon's next pokemonLevel.
-
getExpFraction
public static float getExpFraction(int exp, int expToNextLevel) Gets the fractional progress of experience to the Pokémon's next pokemonLevel.- Parameters:
exp
- The amount of experience the Pokémon has currently gained in the pokemonLevel.expToNextLevel
- The amount of experience between the Pokémon current and next levels.- Returns:
- The fractional progress of experience to the Pokémon's next pokemonLevel.
-
getExpForNextLevelClient
public int getExpForNextLevelClient() -
getExpForLevel
public int getExpForLevel(int level)
-