Package com.minecolonies.core.util
Class ExperienceUtils
java.lang.Object
com.minecolonies.core.util.ExperienceUtils
Utility class for experience calculation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateLevel(double xp) Calculate level depending on the experience.static doublegetPercentOfLevelCompleted(double experience, int level) Calculates how much percent of the current level have been completed.static doublegetXPNeededForNextLevel(int currentLevel) Calculates the xp needed for the next level.
-
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.
-