From 72eb6d8b5df4c86fbf5fb63eb3edae0f8c7e14d8 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 13 Aug 2020 00:35:14 -0400 Subject: Add chat maddox menu and dungeons tracker Don't have strings for Spirit Bone, Spirit Boots or Spirit Pet. Hoping that Spirit Pet tracking works. --- src/main/java/me/Danker/utils/Utils.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 4749305..5dc30c6 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -5,17 +5,20 @@ import java.util.List; import java.util.regex.Matcher; import me.Danker.TheMod; +import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.StringUtils; public class Utils { + public static boolean inSkyblock = false; + public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; @@ -85,4 +88,19 @@ public class Utils { new TextRenderer(mc, text, titleX, titleY, scale); } + public static void checkForSkyblock() { + Minecraft mc = Minecraft.getMinecraft(); + if (mc != null && mc.theWorld != null && !mc.isSingleplayer()) { + ScoreObjective scoreboardObj = mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(1); + if (scoreboardObj != null) { + String scObjName = ScoreboardHandler.cleanSB(scoreboardObj.getDisplayName()); + if (scObjName.contains("SKYBLOCK")) { + inSkyblock = true; + return; + } + } + } + inSkyblock = false; + } + } -- cgit From 67cb5cc2b84743a936aeb8aa3b9e875b2e24a5ea Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 18 Aug 2020 18:56:52 -0400 Subject: Fix capitalization of pets Also move capitalization into Utils --- src/main/java/me/Danker/utils/Utils.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 5dc30c6..835e613 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -103,4 +103,14 @@ public class Utils { inSkyblock = false; } + public static String capitalizeString(String string) { + String[] words = string.split("_"); + + for (int i = 0; i < words.length; i++) { + words[i] = words[i].substring(0, 1).toUpperCase() + words[i].substring(1).toLowerCase(); + } + + return String.join(" ", words); + } + } -- cgit From d23181a65d0e49ea612d7d1ea2ae53701cfe7f0b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 20 Aug 2020 15:55:04 -0400 Subject: Add (unfinished) skyblock players command Still missing JSON key for Jerry Workshop --- src/main/java/me/Danker/utils/Utils.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 835e613..7153014 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -113,4 +113,11 @@ public class Utils { return String.join(" ", words); } + public static double getPercentage(int num1, int num2) { + if (num2 == 0) return 0D; + double result = ((double) num1 * 100D) / (double) num2; + result = Math.round(result * 100D) / 100D; + return result; + } + } -- cgit From ece7f3de65618ee89f86513e4d8307a97c20f012 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 25 Aug 2020 00:18:42 -0400 Subject: Add pet background (temporary) colours and fix Jerry Workshop /sbplayers Colours are temporary, will be changed in a future commit. --- src/main/java/me/Danker/utils/Utils.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 7153014..16f790a 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -4,13 +4,19 @@ import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; +import org.lwjgl.opengl.GL11; + import me.Danker.TheMod; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StringUtils; @@ -120,4 +126,16 @@ public class Utils { return result; } + public static void drawOnSlot(int xSlotPos, int ySlotPos, int colour) { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int guiLeft = (sr.getScaledWidth() - 176) / 2; + int guiTop = (sr.getScaledHeight() - 221) / 2; + int x = guiLeft + xSlotPos; + int y = guiTop + ySlotPos; + + GL11.glTranslated(0, 0, 1); + Gui.drawRect(x, y, x + 16, y + 16, colour); + GL11.glTranslated(0, 0, -1); + } + } -- cgit From d7ca24feedb3ec7226c2832da48bf9f5b1df8054 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 25 Aug 2020 16:41:13 -0400 Subject: Fix pet colour when chest isn't 6 rows --- src/main/java/me/Danker/utils/Utils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 16f790a..0a6cebc 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -12,11 +12,9 @@ import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StringUtils; @@ -126,12 +124,14 @@ public class Utils { return result; } - public static void drawOnSlot(int xSlotPos, int ySlotPos, int colour) { + public static void drawOnSlot(int size, int xSlotPos, int ySlotPos, int colour) { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); int guiLeft = (sr.getScaledWidth() - 176) / 2; int guiTop = (sr.getScaledHeight() - 221) / 2; int x = guiLeft + xSlotPos; int y = guiTop + ySlotPos; + // Move down when chest isn't 6 rows + if (size != 90) y += (6 - (size - 36) / 9) * 9; GL11.glTranslated(0, 0, 1); Gui.drawRect(x, y, x + 16, y + 16, colour); -- cgit From c1ddb82463894e7a2604d85b57f5be640bfbf115 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 27 Aug 2020 01:50:07 -0400 Subject: Fix pet colours being offset by 1 pixel on some GUI scales --- src/main/java/me/Danker/utils/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 0a6cebc..45479f7 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -127,7 +127,7 @@ public class Utils { public static void drawOnSlot(int size, int xSlotPos, int ySlotPos, int colour) { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); int guiLeft = (sr.getScaledWidth() - 176) / 2; - int guiTop = (sr.getScaledHeight() - 221) / 2; + int guiTop = (sr.getScaledHeight() - 222) / 2; int x = guiLeft + xSlotPos; int y = guiTop + ySlotPos; // Move down when chest isn't 6 rows -- cgit From 4a48ac021fa23aadb88f8f690880e6d58538fa0b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 28 Aug 2020 16:06:07 -0400 Subject: Add coins and time (not working) to dungeons tracker, change pet colours Change pet colours to the Steam level colours because I'm uncreative --- src/main/java/me/Danker/utils/Utils.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 45479f7..f0a612e 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -138,4 +138,33 @@ public class Utils { GL11.glTranslated(0, 0, -1); } + public static String getTimeBetween(double timeOne, double timeTwo) { + double secondsBetween = Math.floor(timeTwo - timeOne); + + String timeFormatted = ""; + int days; + int hours; + int minutes; + int seconds; + + if (secondsBetween > 86400) { + // More than 1d, display #d#h + days = (int) (secondsBetween / 86400); + hours = (int) (secondsBetween % 86400 / 3600); + timeFormatted = days + "d" + hours + "h"; + } else if (secondsBetween > 3600) { + // More than 1h, display #h#m + hours = (int) (secondsBetween / 3600); + minutes = (int) (secondsBetween % 3600 / 60); + timeFormatted = hours + "h" + minutes + "m"; + } else { + // Display #m#s + minutes = (int) (secondsBetween / 60); + seconds = (int) (secondsBetween % 60); + timeFormatted = minutes + "m" + seconds + "s"; + } + + return timeFormatted; + } + } -- cgit From aafc6802b16f7f5b92f7ebcfaff263781f6f9546 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 29 Aug 2020 00:30:35 -0400 Subject: Optimize xp to skill level --- src/main/java/me/Danker/utils/Utils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/me/Danker/utils') 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; + } + } -- cgit From 6921e6b5804bebcdabd0a05f187273f005b58bea Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 3 Sep 2020 01:03:59 -0400 Subject: Add (untested) coins spent in dungeons --- src/main/java/me/Danker/utils/Utils.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 2dfa9c3..67f8439 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -171,6 +171,12 @@ public class Utils { return timeFormatted; } + public static String getMoneySpent(double coins) { + double coinsSpentMillions = coins / 1000000D; + coinsSpentMillions = Math.floor(coinsSpentMillions * 100D) / 100D; + return coinsSpentMillions + "M"; + } + public static double xpToSkillLevel(double xp) { for (int i = 0, xpAdded = 0; i < skillXPPerLevel.length; i++) { xpAdded += skillXPPerLevel[i]; -- cgit