aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/utils
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-08-29 00:30:35 -0400
committerbowser0000 <bowser0000@gmail.com>2020-08-29 00:30:35 -0400
commitaafc6802b16f7f5b92f7ebcfaff263781f6f9546 (patch)
treecb144fe36001b8e7694f2a7b855e1de1f194f1e2 /src/main/java/me/Danker/utils
parent1ee91431513617908bcafbe1b60c52a59eb5c7e8 (diff)
downloadSkyblockMod-aafc6802b16f7f5b92f7ebcfaff263781f6f9546.tar.gz
SkyblockMod-aafc6802b16f7f5b92f7ebcfaff263781f6f9546.tar.bz2
SkyblockMod-aafc6802b16f7f5b92f7ebcfaff263781f6f9546.zip
Optimize xp to skill level
Diffstat (limited to 'src/main/java/me/Danker/utils')
-rw-r--r--src/main/java/me/Danker/utils/Utils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index f0a612e..2dfa9c3 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -22,6 +22,10 @@ import net.minecraft.util.StringUtils;
public class Utils {
public static boolean inSkyblock = false;
+ static int[] skillXPPerLevel = {0, 50, 125, 200, 300, 500, 750, 1000, 1500, 2000, 3500, 5000, 7500, 10000, 15000, 20000, 30000, 50000,
+ 75000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000,
+ 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000,
+ 2300000, 2400000, 2500000, 2600000, 2750000, 2900000, 3100000, 3400000, 3700000, 4000000};
public static int getItems(String item) {
Minecraft mc = Minecraft.getMinecraft();
@@ -167,4 +171,14 @@ public class Utils {
return timeFormatted;
}
+ public static double xpToSkillLevel(double xp) {
+ for (int i = 0, xpAdded = 0; i < skillXPPerLevel.length; i++) {
+ xpAdded += skillXPPerLevel[i];
+ if (xp < xpAdded) {
+ return (i - 1) + (xp - (xpAdded - skillXPPerLevel[i])) / skillXPPerLevel[i];
+ }
+ }
+ return 50D;
+ }
+
}