diff options
Diffstat (limited to 'src/main/java/me/Danker/utils')
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 928e02f..29e61ed 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -36,10 +36,11 @@ public class Utils { public static boolean inSkyblock = false; public static boolean inDungeons = 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[] 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, 4300000, + 4600000, 4900000, 5200000, 5500000, 5800000, 6100000, 6400000, 6700000, 7000000}; static int[] dungeonsXPPerLevel = {0, 50, 75, 110, 160, 230, 330, 470, 670, 950, 1340, 1890, 2665, 3760, 5260, 7380, 10300, 14400, 20000, 27600, 38000, 52500, 71500, 97000, 132000, 180000, 243000, 328000, 445000, 600000, 800000, 1065000, 1410000, 1900000, 2500000, 3300000, 4300000, 5600000, 7200000, 9200000, 12000000, 15000000, @@ -212,14 +213,14 @@ public class Utils { return coinsSpentMillions + "M"; } - public static double xpToSkillLevel(double xp) { - for (int i = 0, xpAdded = 0; i < skillXPPerLevel.length; i++) { + public static double xpToSkillLevel(double xp, int limit) { + for (int i = 0, xpAdded = 0; i < limit + 1; i++) { xpAdded += skillXPPerLevel[i]; if (xp < xpAdded) { return (i - 1) + (xp - (xpAdded - skillXPPerLevel[i])) / skillXPPerLevel[i]; } } - return 50D; + return limit; } public static double xpToDungeonsLevel(double xp) { @@ -242,9 +243,9 @@ public class Utils { return -1; } - public static int getPastXpEarned(int currentLevelXp) { - if (currentLevelXp == 0) return 55172425; - for (int i = 1, xpAdded = 0; i < skillXPPerLevel.length; i++) { + public static int getPastXpEarned(int currentLevelXp, int limit) { + if (currentLevelXp == 0) return skillXPPerLevel[limit]; + for (int i = 1, xpAdded = 0; i < limit; i++) { xpAdded += skillXPPerLevel[i - 1]; if (currentLevelXp == skillXPPerLevel[i]) return xpAdded; } @@ -311,9 +312,10 @@ public class Utils { } // Yoinked from ForgeHax - public static void draw3DBox(AxisAlignedBB aabb, int r, int g, int b, int a, float partialTicks) { + public static void draw3DBox(AxisAlignedBB aabb, int colourInt, float partialTicks) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + Color colour = new Color(colourInt); double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; @@ -326,7 +328,7 @@ public class Utils { GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GL11.glLineWidth(2); - GlStateManager.color(r / 255f, g / 255f, b / 255f, a / 255f); + GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); |