Class ExperienceUtils

java.lang.Object
com.minecolonies.core.util.ExperienceUtils

public final class ExperienceUtils extends Object
Utility class for experience calculation.
  • Method Details

    • getPercentOfLevelCompleted

      public static double getPercentOfLevelCompleted(double experience, int level)
      Calculates how much percent of the current level have been completed.
      Parameters:
      experience - the current amount of xp.
      level - the current level.
      Returns:
      the percentage.
    • getXPNeededForNextLevel

      public static double getXPNeededForNextLevel(int currentLevel)
      Calculates the xp needed for the next level.
      Parameters:
      currentLevel - the currentLevel of the citizen
      Returns:
      the xp in int
    • calculateLevel

      public static int calculateLevel(double xp)
      Calculate level depending on the experience.
      Parameters:
      xp - the experience to calculate it for.
      Returns:
      the correct level.