Class PokemonLevel

java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.stats.PokemonLevel
Direct Known Subclasses:
TempBattlePokemonLevel

public class PokemonLevel extends Object
A Pokémon's pokemonLevel.
  • Field Details

    • pixelmon

      protected DelegateLink pixelmon
      The Pokémon who has this pokemonLevel.
    • lastLevelType

      protected ExperienceGainType lastLevelType
      The type of experience that gave the last level.
    • expToNextLevel

      public int expToNextLevel
      The experience remaining until the next pokemonLevel.
  • Constructor Details

    • PokemonLevel

      public PokemonLevel(DelegateLink p)
      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

      public ExperienceGainType 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

      protected void onLevelUp(PixelmonStatsData stats)
      Updates the Pokémon's stats upon leveling up.
      Parameters:
      stats - The stats to update.
    • awardEXP

      public void awardEXP(int experience)
      See Also:
    • awardEXP

      public void awardEXP(int experience, ExperienceGainType type)
    • 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)