From 9e5039be5c1f874a6622301daca2b6780dec02ca Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 17 Jun 2021 00:07:21 -0400 Subject: Add enderman slayer tracker Also add support for counting 20% drops in chat and tier 5 rev dropping viscera --- src/main/java/me/Danker/gui/DisplayGui.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 38459ee..e5a6641 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -20,6 +20,7 @@ public class DisplayGui extends GuiScreen { private GuiButton zombie; private GuiButton spider; private GuiButton wolf; + private GuiButton enderman; private GuiButton auto; private GuiButton fishing; private GuiButton fishingWinter; @@ -52,9 +53,10 @@ public class DisplayGui extends GuiScreen { showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off"); auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); - zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 110, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 55, (int) (height * 0.3), 110, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 75, (int) (height * 0.3), 110, 20, "Wolf"); + zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.3), 100, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.3), 100, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 100, 20, "Wolf"); + enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.3), 100, 20, "Enderman"); fishing = new GuiButton(0, width / 2 - 230, (int) (height * 0.4), 100, 20, "Fishing"); fishingWinter = new GuiButton(0, width / 2 - 110, (int) (height * 0.4), 100, 20, "Fishing Winter"); fishingFestival = new GuiButton(0, width / 2 + 10, (int) (height * 0.4), 100, 20, "Fishing Festival"); @@ -75,6 +77,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(zombie); this.buttonList.add(spider); this.buttonList.add(wolf); + this.buttonList.add(enderman); this.buttonList.add(fishing); this.buttonList.add(fishingWinter); this.buttonList.add(fishingFestival); @@ -127,6 +130,8 @@ public class DisplayGui extends GuiScreen { setDisplay("spider", false); } else if (button == wolf) { setDisplay("wolf", false); + } else if (button == enderman) { + setDisplay("enderman", false); } else if (button == auto) { LootDisplay.auto = true; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); -- cgit From c466240003b130b43c17da9e585b80380154e4c4 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 24 Nov 2021 21:58:26 -0500 Subject: Add custom alerts based on chat Also move some other stuff around --- README.md | 1 + src/main/java/me/Danker/DankersSkyblockMod.java | 25 +--- .../java/me/Danker/commands/ToggleCommand.java | 11 +- src/main/java/me/Danker/features/Alerts.java | 81 ++++++++++++ .../me/Danker/gui/CrystalHollowAddWaypointGui.java | 118 ----------------- .../Danker/gui/CrystalHollowWaypointActionGui.java | 94 ------------- .../me/Danker/gui/CrystalHollowWaypointsGui.java | 144 -------------------- src/main/java/me/Danker/gui/CustomMusicGui.java | 2 +- src/main/java/me/Danker/gui/DankerGui.java | 23 ++-- src/main/java/me/Danker/gui/DisplayGui.java | 2 +- src/main/java/me/Danker/gui/ExperimentsGui.java | 2 +- src/main/java/me/Danker/gui/OnlySlayerGui.java | 2 +- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 2 +- src/main/java/me/Danker/gui/SkillTrackerGui.java | 2 +- .../java/me/Danker/gui/alerts/AlertActionGui.java | 82 ++++++++++++ .../java/me/Danker/gui/alerts/AlertAddGui.java | 130 ++++++++++++++++++ src/main/java/me/Danker/gui/alerts/AlertsGui.java | 104 +++++++++++++++ .../CrystalHollowAddWaypointGui.java | 118 +++++++++++++++++ .../CrystalHollowWaypointActionGui.java | 95 ++++++++++++++ .../CrystalHollowWaypointsGui.java | 145 +++++++++++++++++++++ .../java/me/Danker/handlers/ConfigHandler.java | 42 ++++-- 21 files changed, 821 insertions(+), 404 deletions(-) create mode 100644 src/main/java/me/Danker/features/Alerts.java delete mode 100644 src/main/java/me/Danker/gui/CrystalHollowAddWaypointGui.java delete mode 100644 src/main/java/me/Danker/gui/CrystalHollowWaypointActionGui.java delete mode 100644 src/main/java/me/Danker/gui/CrystalHollowWaypointsGui.java create mode 100644 src/main/java/me/Danker/gui/alerts/AlertActionGui.java create mode 100644 src/main/java/me/Danker/gui/alerts/AlertAddGui.java create mode 100644 src/main/java/me/Danker/gui/alerts/AlertsGui.java create mode 100644 src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java create mode 100644 src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java create mode 100644 src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/README.md b/README.md index 559b60e..4f82ca3 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Discord Server: https://discord.gg/QsEkNQS - Custom name colors - Crystal Hollows waypoints (with SkyblockExtras support) - Ability cooldowns display +- Custom alerts based on chat ## Commands - /dhelp - Returns this message in-game. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 9fb7876..2ad5141 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -9,6 +9,7 @@ import me.Danker.features.*; import me.Danker.features.loot.*; import me.Danker.features.puzzlesolvers.*; import me.Danker.gui.*; +import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.PacketHandler; import me.Danker.utils.RenderUtils; @@ -101,6 +102,7 @@ public class DankersSkyblockMod { public void init(FMLInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new AbilityCooldowns()); + MinecraftForge.EVENT_BUS.register(new Alerts()); MinecraftForge.EVENT_BUS.register(new ArachneESP()); MinecraftForge.EVENT_BUS.register(new ArrowTerminalSolver()); MinecraftForge.EVENT_BUS.register(new AutoAcceptReparty()); @@ -170,6 +172,8 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new WolfTracker()); MinecraftForge.EVENT_BUS.register(new ZombieTracker()); + Alerts.configFile = configDirectory + "/dsmalerts.json"; + ConfigHandler.reloadConfig(); GoldenEnchants.init(); TriviaSolver.init(); @@ -434,27 +438,6 @@ public class DankersSkyblockMod { case "displaygui": mc.displayGuiScreen(new DisplayGui()); break; - case "onlyslayergui": - mc.displayGuiScreen(new OnlySlayerGui()); - break; - case "editlocations": - mc.displayGuiScreen(new EditLocationsGui()); - break; - case "puzzlesolvers": - mc.displayGuiScreen(new PuzzleSolversGui(1)); - break; - case "experimentsolvers": - mc.displayGuiScreen(new ExperimentsGui()); - break; - case "skilltracker": - mc.displayGuiScreen(new SkillTrackerGui()); - break; - case "custommusic": - mc.displayGuiScreen(new CustomMusicGui(1)); - break; - case "crystalwaypoints": - mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); - break; case "inventory": mc.displayGuiScreen(InventoryCommand.chest); break; diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 321458e..d9ef9b3 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -46,6 +46,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean crystalAutoWaypoints; public static boolean autoAcceptReparty; public static boolean abilityCooldowns; + public static boolean alerts; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; @@ -144,7 +145,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "autoacceptreparty", "itemcooldowns", "hubmusic", "islandmusic", "dungeonhubmusic", "farmingislandsmusic", "goldminemusic", "deepcavernsmusic", "dwarvenminesmusic", "crystalhollowsmusic", "spidersdenmusic", "blazingfortressmusic", - "endmusic", "parkmusic", "list"); + "endmusic", "parkmusic", "alerts", "list"); } return null; } @@ -586,6 +587,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "DungeonMusic", parkMusic); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom park music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + parkMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "alert": + alerts = !alerts; + ConfigHandler.writeBooleanConfig("toggles", "Alerts", alerts); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Alerts has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + alerts + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + @@ -659,7 +665,8 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Custom spider's den music: " + DankersSkyblockMod.VALUE_COLOUR + spidersDenMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom blazing fortress music: " + DankersSkyblockMod.VALUE_COLOUR + blazingFortressMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom end music: " + DankersSkyblockMod.VALUE_COLOUR + endMusic + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Custom park music: " + DankersSkyblockMod.VALUE_COLOUR + parkMusic + DankersSkyblockMod.TYPE_COLOUR + " Custom park music: " + DankersSkyblockMod.VALUE_COLOUR + parkMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Alerts: " + DankersSkyblockMod.VALUE_COLOUR + alerts )); break; default: diff --git a/src/main/java/me/Danker/features/Alerts.java b/src/main/java/me/Danker/features/Alerts.java new file mode 100644 index 0000000..2a00fef --- /dev/null +++ b/src/main/java/me/Danker/features/Alerts.java @@ -0,0 +1,81 @@ +package me.Danker.features; + +import com.google.gson.GsonBuilder; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class Alerts { + + public static List alerts = new ArrayList<>(); + public static String configFile; + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if (!ToggleCommand.alerts || !Utils.inSkyblock || event.type == 2) return; + + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + for (Alert alert : alerts) { + if (!alert.toggled) continue; + + boolean trigger; + switch (alert.mode) { + case "Starts With": + trigger = message.startsWith(alert.message); + break; + case "Contains": + trigger = message.contains(alert.message); + break; + case "Ends With": + trigger = message.endsWith(alert.message); + break; + default: + continue; + } + + if (trigger) { + Utils.createTitle(EnumChatFormatting.RED + alert.alert.replace("&", "ยง"), 2); + return; + } + } + } + + public static void saveToFile() { + try (FileWriter writer = new FileWriter(configFile)) { + new GsonBuilder().create().toJson(alerts, writer); + writer.flush(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static class Alert { + + public String mode; + public String message; + public String alert; + public boolean toggled; + + public Alert(String mode, String message, String alert, boolean toggled) { + this.mode = mode; + this.message = message; + this.alert = alert; + this.toggled = toggled; + } + + public void toggle() { + toggled = !toggled; + } + + } + +} diff --git a/src/main/java/me/Danker/gui/CrystalHollowAddWaypointGui.java b/src/main/java/me/Danker/gui/CrystalHollowAddWaypointGui.java deleted file mode 100644 index 7bb26cf..0000000 --- a/src/main/java/me/Danker/gui/CrystalHollowAddWaypointGui.java +++ /dev/null @@ -1,118 +0,0 @@ -package me.Danker.gui; - -import me.Danker.features.CrystalHollowWaypoints; -import me.Danker.handlers.TextRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiTextField; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; - -import java.io.IOException; - -public class CrystalHollowAddWaypointGui extends GuiScreen { - - private GuiButton cancel; - - private GuiTextField name; - private GuiButton curPos; - private GuiTextField x; - private GuiTextField y; - private GuiTextField z; - private GuiButton add; - - @Override - public boolean doesGuiPauseGame() { - return false; - } - - @Override - public void initGui() { - super.initGui(); - - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - int height = sr.getScaledHeight(); - int width = sr.getScaledWidth(); - - cancel = new GuiButton(0, 2, height - 30, 100, 20, "Cancel"); - - name = new GuiTextField(0, this.fontRendererObj, width / 2 - 100, (int) (height * 0.1), 200, 20); - curPos = new GuiButton(0, width / 2 - 50, (int) (height * 0.25), 100, 20, "Current Position"); - x = new GuiTextField(0, this.fontRendererObj, width / 2 - 85, (int) (height * 0.4), 50, 20); - y = new GuiTextField(0, this.fontRendererObj, width / 2 - 25, (int) (height * 0.4), 50, 20); - z = new GuiTextField(0, this.fontRendererObj, width / 2 + 35, (int) (height * 0.4), 50, 20); - add = new GuiButton(0, width / 2 - 25, (int) (height * 0.6), 50, 20, "Add"); - - name.setVisible(true); - name.setEnabled(true); - x.setVisible(true); - x.setEnabled(true); - y.setVisible(true); - y.setEnabled(true); - z.setVisible(true); - z.setEnabled(true); - - this.buttonList.add(cancel); - this.buttonList.add(curPos); - this.buttonList.add(add); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - super.drawScreen(mouseX, mouseY, partialTicks); - - name.drawTextBox(); - x.drawTextBox(); - y.drawTextBox(); - z.drawTextBox(); - - new TextRenderer(mc, "X:", width / 2 - 85, (int) (height * 0.35), 1D); - new TextRenderer(mc, "Y:", width / 2 - 25, (int) (height * 0.35), 1D); - new TextRenderer(mc, "Z:", width / 2 + 35, (int) (height * 0.35), 1D); - } - - @Override - public void actionPerformed(GuiButton button) { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - - if (button == cancel) { - mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); - } else if (button == curPos) { - x.setText(Integer.toString(player.getPosition().getX())); - y.setText(Integer.toString(player.getPosition().getY())); - z.setText(Integer.toString(player.getPosition().getZ())); - } else if (button == add) { - String loc = name.getText().length() == 0 ? Integer.toString(CrystalHollowWaypoints.waypoints.size()) : name.getText(); - int xPos = x.getText().matches("[-]?\\d+") ? Integer.parseInt(x.getText()) : player.getPosition().getX(); - int yPos = y.getText().matches("[-]?\\d+") ? Integer.parseInt(y.getText()) : player.getPosition().getY(); - int zPos = z.getText().matches("[-]?\\d+") ? Integer.parseInt(z.getText()) : player.getPosition().getZ(); - - BlockPos pos = new BlockPos(xPos, yPos, zPos); - CrystalHollowWaypoints.waypoints.add(new CrystalHollowWaypoints.Waypoint(loc, pos)); - - mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); - } - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - name.mouseClicked(mouseX, mouseY, mouseButton); - x.mouseClicked(mouseX, mouseY, mouseButton); - y.mouseClicked(mouseX, mouseY, mouseButton); - z.mouseClicked(mouseX, mouseY, mouseButton); - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - name.textboxKeyTyped(typedChar, keyCode); - x.textboxKeyTyped(typedChar, keyCode); - y.textboxKeyTyped(typedChar, keyCode); - z.textboxKeyTyped(typedChar, keyCode); - } - -} diff --git a/src/main/java/me/Danker/gui/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/CrystalHollowWaypointActionGui.java deleted file mode 100644 index 1575c18..0000000 --- a/src/main/java/me/Danker/gui/CrystalHollowWaypointActionGui.java +++ /dev/null @@ -1,94 +0,0 @@ -package me.Danker.gui; - -import me.Danker.DankersSkyblockMod; -import me.Danker.features.CrystalHollowWaypoints; -import me.Danker.handlers.TextRenderer; -import me.Danker.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.util.EnumChatFormatting; - -public class CrystalHollowWaypointActionGui extends GuiScreen { - - private int id; - - private GuiButton goBack; - private GuiButton toggle; - private GuiButton sendNormal; - private GuiButton sendDSM; - private GuiButton sendSBE; - private GuiButton delete; - - public CrystalHollowWaypointActionGui(int id) { - this.id = id; - } - - @Override - public boolean doesGuiPauseGame() { - return false; - } - - @Override - public void initGui() { - super.initGui(); - - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - int height = sr.getScaledHeight(); - int width = sr.getScaledWidth(); - - CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); - - goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); - toggle = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Set Visibility: " + Utils.getColouredBoolean(waypoint.toggled)); - sendNormal = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Send Location And Coordinates"); - sendDSM = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Send DSM Formatted Waypoint"); - sendSBE = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Send SBE Formatted Waypoint"); - delete = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), EnumChatFormatting.RED + "Delete Waypoint"); - - this.buttonList.add(toggle); - this.buttonList.add(sendNormal); - this.buttonList.add(sendDSM); - this.buttonList.add(sendSBE); - this.buttonList.add(delete); - this.buttonList.add(goBack); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - super.drawScreen(mouseX, mouseY, partialTicks); - - CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); - - String waypointText = waypoint.location + " @ " + waypoint.getPos(); - int pageWidth = mc.fontRendererObj.getStringWidth(waypointText); - new TextRenderer(mc, waypointText, width / 2 - pageWidth / 2, 10, 1D); - } - - @Override - public void actionPerformed(GuiButton button) { - CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - if (button == goBack) { - DankersSkyblockMod.guiToOpen = "crystalwaypoints"; - } else if (button == toggle) { - waypoint.toggle(); - toggle.displayString = "Set Visibility: " + Utils.getColouredBoolean(waypoint.toggled); - } else if (button == sendNormal) { - player.sendChatMessage(waypoint.location + " @ " + waypoint.getPos()); - } else if (button == sendDSM) { - player.sendChatMessage("$DSMCHWP:" + waypoint.getFormattedWaypoint()); - } else if (button == sendSBE) { - player.sendChatMessage("$SBECHWP:" + waypoint.getFormattedWaypoint()); - } else if (button == delete) { - CrystalHollowWaypoints.waypoints.remove(id); - mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); - return; - } - CrystalHollowWaypoints.waypoints.set(id, waypoint); - } - -} diff --git a/src/main/java/me/Danker/gui/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/CrystalHollowWaypointsGui.java deleted file mode 100644 index de20cf1..0000000 --- a/src/main/java/me/Danker/gui/CrystalHollowWaypointsGui.java +++ /dev/null @@ -1,144 +0,0 @@ -package me.Danker.gui; - -import me.Danker.DankersSkyblockMod; -import me.Danker.commands.ToggleCommand; -import me.Danker.features.CrystalHollowWaypoints; -import me.Danker.gui.buttons.FeatureButton; -import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; -import me.Danker.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; - -import java.util.ArrayList; -import java.util.List; - -public class CrystalHollowWaypointsGui extends GuiScreen { - - private final int page; - private final List allButtons = new ArrayList<>(); - - private GuiButton goBack; - private GuiButton backPage; - private GuiButton nextPage; - private GuiButton sendDSM; - private GuiButton sendSBE; - private GuiButton add; - private FeatureButton crystalHollowWaypoints; - private FeatureButton crystalAutoWaypoints; - - public CrystalHollowWaypointsGui(int page) { - this.page = page; - } - - @Override - public boolean doesGuiPauseGame() { - return false; - } - - @Override - public void initGui() { - super.initGui(); - - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - int height = sr.getScaledHeight(); - int width = sr.getScaledWidth(); - - goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); - backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back"); - nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); - sendDSM = new GuiButton(0, 2, 10, 175, 20, "Send DSM Formatted Waypoints"); - sendSBE = new GuiButton(0, 2, 40, 175, 20, "Send SBE Formatted Waypoints"); - add = new GuiButton(0, 0, 0, "Add Waypoint"); - crystalHollowWaypoints = new FeatureButton("Crystal Hollows Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowWaypoints), "Shows waypoints to various places in the Crystal Hollows."); - crystalAutoWaypoints = new FeatureButton("Auto Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoWaypoints), "Automatically creates waypoints when you visit a special place in the Crystal Hollows."); - - allButtons.clear(); - allButtons.add(add); - allButtons.add(crystalHollowWaypoints); - allButtons.add(crystalAutoWaypoints); - for (int i = 0; i < CrystalHollowWaypoints.waypoints.size(); i++) { - CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(i); - GuiButton button = new GuiButton(i, 0, 0, waypoint.location + " >"); - allButtons.add(button); - } - - reInit(); - } - - public void reInit() { - this.buttonList.clear(); - - for (int i = (page - 1) * 7, iteration = 0; iteration < 7 && i < allButtons.size(); i++, iteration++) { - GuiButton button = allButtons.get(i); - button.xPosition = width / 2 - 100; - button.yPosition = (int) (height * (0.1 * (iteration + 1))); - this.buttonList.add(button); - } - - if (page > 1) this.buttonList.add(backPage); - if (page < Math.ceil(allButtons.size() / 7D)) this.buttonList.add(nextPage); - - this.buttonList.add(goBack); - this.buttonList.add(sendDSM); - this.buttonList.add(sendSBE); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - super.drawScreen(mouseX, mouseY, partialTicks); - - String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); - } - - @Override - public void actionPerformed(GuiButton button) { - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; - } else if (button == nextPage) { - mc.displayGuiScreen(new CrystalHollowWaypointsGui(page + 1)); - } else if (button == backPage) { - mc.displayGuiScreen(new CrystalHollowWaypointsGui(page - 1)); - } else if (button == sendDSM) { - if (CrystalHollowWaypoints.waypoints.size() > 0) { - StringBuilder message = new StringBuilder(); - for (CrystalHollowWaypoints.Waypoint waypoint : CrystalHollowWaypoints.waypoints) { - if (message.length() > 0) message.append("\\n"); - message.append(waypoint.getFormattedWaypoint()); - } - message.insert(0, "$DSMCHWP:"); - player.sendChatMessage(message.toString()); - } - } else if (button == sendSBE) { - if (CrystalHollowWaypoints.waypoints.size() > 0) { - StringBuilder message = new StringBuilder(); - for (CrystalHollowWaypoints.Waypoint waypoint : CrystalHollowWaypoints.waypoints) { - if (message.length() > 0) message.append("\\n"); - message.append(waypoint.getFormattedWaypoint()); - } - message.insert(0, "$SBECHWP:"); - player.sendChatMessage(message.toString()); - } - } else if (button == add) { - mc.displayGuiScreen(new CrystalHollowAddWaypointGui()); - } else if (button == crystalHollowWaypoints) { - ToggleCommand.crystalHollowWaypoints = !ToggleCommand.crystalHollowWaypoints; - ConfigHandler.writeBooleanConfig("toggles", "CrystalHollowWaypoints", ToggleCommand.crystalHollowWaypoints); - crystalHollowWaypoints.displayString = "Crystal Hollows Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowWaypoints); - } else if (button == crystalAutoWaypoints) { - ToggleCommand.crystalAutoWaypoints = !ToggleCommand.crystalAutoWaypoints; - ConfigHandler.writeBooleanConfig("toggles", "CrystalAutoWaypoints", ToggleCommand.crystalAutoWaypoints); - crystalAutoWaypoints.displayString = "Auto Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoWaypoints); - } else { - mc.displayGuiScreen(new CrystalHollowWaypointActionGui(button.id)); - } - } - -} diff --git a/src/main/java/me/Danker/gui/CustomMusicGui.java b/src/main/java/me/Danker/gui/CustomMusicGui.java index 83bed09..6695b9a 100644 --- a/src/main/java/me/Danker/gui/CustomMusicGui.java +++ b/src/main/java/me/Danker/gui/CustomMusicGui.java @@ -111,7 +111,7 @@ public class CustomMusicGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; + mc.displayGuiScreen(new DankerGui(1, "")); } else if (button == backPage) { Minecraft.getMinecraft().displayGuiScreen(new CustomMusicGui(page - 1)); } else if (button == nextPage) { diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index acd997e..2a081e1 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -2,7 +2,9 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.gui.alerts.AlertsGui; import me.Danker.gui.buttons.FeatureButton; +import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; @@ -43,6 +45,7 @@ public class DankerGui extends GuiScreen { private GuiButton skillTracker; private GuiButton customMusic; private GuiButton crystalHollowWaypoints; + private GuiButton alerts; // Toggles private GuiButton gparty; private GuiButton coords; @@ -124,6 +127,7 @@ public class DankerGui extends GuiScreen { skillTracker = new GuiButton(0, 0, 0, "Toggle Skill XP/Hour Tracking"); customMusic = new GuiButton(0, 0, 0, "Custom Music"); crystalHollowWaypoints = new GuiButton(0, 0, 0, "Crystal Hollows Waypoints"); + alerts = new GuiButton(0, 0, 0, "Alerts"); outlineText = new FeatureButton("Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled), "Adds bold outline to on-screen text."); pickBlock = new FeatureButton("Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockToggled), "Automatically changes left clicks to middle clicks.\nHelpful when lagging."); coords = new FeatureButton("Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled), "Displays coordinates and angle."); @@ -177,6 +181,7 @@ public class DankerGui extends GuiScreen { allButtons.add(skillTracker); allButtons.add(customMusic); allButtons.add(crystalHollowWaypoints); + allButtons.add(alerts); allButtons.add(outlineText); allButtons.add(pickBlock); allButtons.add(coords); @@ -288,7 +293,7 @@ public class DankerGui extends GuiScreen { } else if (button == backPage) { mc.displayGuiScreen(new DankerGui(page - 1, search.getText())); } else if (button == editLocations) { - DankersSkyblockMod.guiToOpen = "editlocations"; + mc.displayGuiScreen(new EditLocationsGui()); } else if (button == githubLink) { try { Desktop.getDesktop().browse(new URI("https://github.com/bowser0000/SkyblockMod")); @@ -302,19 +307,21 @@ public class DankerGui extends GuiScreen { ex.printStackTrace(); } } else if (button == changeDisplay) { - DankersSkyblockMod.guiToOpen = "displaygui"; + mc.displayGuiScreen(new DisplayGui()); } else if (button == onlySlayer) { - DankersSkyblockMod.guiToOpen = "onlyslayergui"; + mc.displayGuiScreen(new OnlySlayerGui()); } else if (button == puzzleSolvers) { - DankersSkyblockMod.guiToOpen = "puzzlesolvers"; + mc.displayGuiScreen(new PuzzleSolversGui(1)); } else if (button == experimentationTableSolvers) { - DankersSkyblockMod.guiToOpen = "experimentsolvers"; + mc.displayGuiScreen(new ExperimentsGui()); } else if (button == skillTracker) { - DankersSkyblockMod.guiToOpen = "skilltracker"; + mc.displayGuiScreen(new SkillTrackerGui()); } else if (button == customMusic) { - DankersSkyblockMod.guiToOpen = "custommusic"; + mc.displayGuiScreen(new CustomMusicGui(1)); } else if (button == crystalHollowWaypoints) { - DankersSkyblockMod.guiToOpen = "crystalwaypoints"; + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + } else if (button == alerts) { + mc.displayGuiScreen(new AlertsGui(1)); } else if (button == outlineText) { ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index e5a6641..c6b1381 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -118,7 +118,7 @@ public class DisplayGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; + mc.displayGuiScreen(new DankerGui(1, "")); } else if (button == showSession) { addSession = !addSession; showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java index c3f4f47..3cc4929 100644 --- a/src/main/java/me/Danker/gui/ExperimentsGui.java +++ b/src/main/java/me/Danker/gui/ExperimentsGui.java @@ -52,7 +52,7 @@ public class ExperimentsGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; + mc.displayGuiScreen(new DankerGui(1, "")); } else if (button == ultrasequencer) { ToggleCommand.ultrasequencerToggled = !ToggleCommand.ultrasequencerToggled; ConfigHandler.writeBooleanConfig("toggles", "UltraSequencer", ToggleCommand.ultrasequencerToggled); diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index 8d56156..c203b8a 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -106,7 +106,7 @@ public class OnlySlayerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; + mc.displayGuiScreen(new DankerGui(1, "")); return; } else if (button == off) { BlockWrongSlayer.onlySlayerName = ""; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 27233d8..3356ead 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -110,7 +110,7 @@ public class PuzzleSolversGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; + mc.displayGuiScreen(new DankerGui(1, "")); } else if (button == backPage) { Minecraft.getMinecraft().displayGuiScreen(new PuzzleSolversGui(page - 1)); } else if (button == nextPage) { diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java index fb7a7c9..290310f 100644 --- a/src/main/java/me/Danker/gui/SkillTrackerGui.java +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -67,7 +67,7 @@ public class SkillTrackerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; + mc.displayGuiScreen(new DankerGui(1, "")); } else if (button == start) { if (SkillTracker.skillStopwatch.isStarted() && SkillTracker.skillStopwatch.isSuspended()) { SkillTracker.skillStopwatch.resume(); diff --git a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java new file mode 100644 index 0000000..06dfd91 --- /dev/null +++ b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java @@ -0,0 +1,82 @@ +package me.Danker.gui.alerts; + +import me.Danker.features.Alerts; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; + +public class AlertActionGui extends GuiScreen { + + private final int id; + + private GuiButton goBack; + private GuiButton toggle; + private GuiButton edit; + private GuiButton delete; + + public AlertActionGui(int id) { + this.id = id; + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + Alerts.Alert alert = Alerts.alerts.get(id); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + toggle = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Enabled: " + Utils.getColouredBoolean(alert.toggled)); + edit = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Edit >"); + delete = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), EnumChatFormatting.RED + "Delete Alert"); + + this.buttonList.add(toggle); + this.buttonList.add(edit); + this.buttonList.add(delete); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + Alerts.Alert alert = Alerts.alerts.get(id); + + String alertText = alert.alert; + int textWidth = mc.fontRendererObj.getStringWidth(alertText); + new TextRenderer(mc, alertText, width / 2 - textWidth / 2, 10, 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + Alerts.Alert alert = Alerts.alerts.get(id); + if (button == goBack) { + mc.displayGuiScreen(new AlertsGui(1)); + } else if (button == toggle) { + alert.toggle(); + toggle.displayString = "Enabled: " + Utils.getColouredBoolean(alert.toggled); + } else if (button == edit) { + mc.displayGuiScreen(new AlertAddGui(alert, id)); + } else if (button == delete) { + Alerts.alerts.remove(id); + Alerts.saveToFile(); + mc.displayGuiScreen(new AlertsGui(1)); + return; + } + Alerts.alerts.set(id, alert); + } + +} diff --git a/src/main/java/me/Danker/gui/alerts/AlertAddGui.java b/src/main/java/me/Danker/gui/alerts/AlertAddGui.java new file mode 100644 index 0000000..9014ea1 --- /dev/null +++ b/src/main/java/me/Danker/gui/alerts/AlertAddGui.java @@ -0,0 +1,130 @@ +package me.Danker.gui.alerts; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import me.Danker.features.Alerts; +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraftforge.fml.client.config.GuiCheckBox; + +import java.io.FileWriter; +import java.io.IOException; + +public class AlertAddGui extends GuiScreen { + + private boolean editing; + private Alerts.Alert base = null; + private int id; + + private GuiButton cancel; + + private String mode = "Contains"; + private GuiButton startsWith; + private GuiButton contains; + private GuiButton endsWith; + private GuiTextField message; + private GuiTextField alert; + private GuiCheckBox toggled; + private GuiButton add; + + public AlertAddGui() {} + + public AlertAddGui(Alerts.Alert alert, int id) { + editing = true; + base = alert; + this.id = id; + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + cancel = new GuiButton(0, 2, height - 30, 100, 20, "Cancel"); + + startsWith = new GuiButton(0, width / 2 - 200, (int) (height * 0.2), 120, 20, "Starts With"); + contains = new GuiButton(0, width / 2 - 60, (int) (height * 0.2), 120, 20, "Contains"); + endsWith = new GuiButton(0, width / 2 + 80, (int) (height * 0.2), 120, 20, "Ends With"); + message = new GuiTextField(0, this.fontRendererObj, width / 2 - 100, (int) (height * 0.3), 200, 20); + alert = new GuiTextField(0, this.fontRendererObj, width / 2 - 100, (int) (height * 0.4), 200, 20); + toggled = new GuiCheckBox(0, width / 2 - 26, (int) (height * 0.5), "Toggled", true); + add = new GuiButton(0, width / 2 - 25, (int) (height * 0.7), 50, 20, "Add"); + + if (editing) { + mode = base.mode; + message.setText(base.message); + alert.setText(base.alert); + toggled.setIsChecked(base.toggled); + } + + message.setVisible(true); + message.setEnabled(true); + alert.setVisible(true); + alert.setEnabled(true); + + this.buttonList.add(cancel); + this.buttonList.add(startsWith); + this.buttonList.add(contains); + this.buttonList.add(endsWith); + this.buttonList.add(toggled); + this.buttonList.add(add); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + message.drawTextBox(); + alert.drawTextBox(); + + new TextRenderer(mc, "Mode: " + mode, width / 2 - 35, (int) (height * 0.15), 1D); + new TextRenderer(mc, "Trigger:", width / 2 - 145, (int) (height * 0.32), 1D); + new TextRenderer(mc, "Alert Text:", width / 2 - 158, (int) (height * 0.42), 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == cancel) { + mc.displayGuiScreen(new AlertsGui(1)); + } else if (button == startsWith) { + mode = "Starts With"; + } else if (button == contains) { + mode = "Contains"; + } else if (button == endsWith) { + mode = "Ends With"; + } else if (button == add) { + Alerts.alerts.add(new Alerts.Alert(mode, message.getText(), alert.getText(), toggled.isChecked())); + if (editing) Alerts.alerts.remove(id); + Alerts.saveToFile(); + mc.displayGuiScreen(new AlertsGui(1)); + } + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + message.mouseClicked(mouseX, mouseY, mouseButton); + alert.mouseClicked(mouseX, mouseY, mouseButton); + } + + @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException { + super.keyTyped(typedChar, keyCode); + message.textboxKeyTyped(typedChar, keyCode); + alert.textboxKeyTyped(typedChar, keyCode); + } + +} diff --git a/src/main/java/me/Danker/gui/alerts/AlertsGui.java b/src/main/java/me/Danker/gui/alerts/AlertsGui.java new file mode 100644 index 0000000..3ccd869 --- /dev/null +++ b/src/main/java/me/Danker/gui/alerts/AlertsGui.java @@ -0,0 +1,104 @@ +package me.Danker.gui.alerts; + +import me.Danker.commands.ToggleCommand; +import me.Danker.features.Alerts; +import me.Danker.gui.DankerGui; +import me.Danker.gui.buttons.FeatureButton; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +import java.util.ArrayList; +import java.util.List; + +public class AlertsGui extends GuiScreen { + + private final int page; + private final List allButtons = new ArrayList<>(); + + private GuiButton goBack; + private GuiButton backPage; + private GuiButton nextPage; + private GuiButton add; + private GuiButton alerts; + + public AlertsGui(int page) { + this.page = page; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back"); + nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); + alerts = new FeatureButton("Alerts: " + Utils.getColouredBoolean(ToggleCommand.alerts), "Sends custom alert when a message is recieved"); + add = new GuiButton(0, 0, 0, "Add Alert"); + + allButtons.clear(); + allButtons.add(alerts); + allButtons.add(add); + for (int i = 0; i < Alerts.alerts.size(); i++) { + Alerts.Alert alert = Alerts.alerts.get(i); + GuiButton button = new GuiButton(i, 0, 0, alert.alert + " >"); + allButtons.add(button); + } + + reInit(); + } + + public void reInit() { + this.buttonList.clear(); + + for (int i = (page - 1) * 7, iteration = 0; iteration < 7 && i < allButtons.size(); i++, iteration++) { + GuiButton button = allButtons.get(i); + button.xPosition = width / 2 - 100; + button.yPosition = (int) (height * (0.1 * (iteration + 1))); + this.buttonList.add(button); + } + + if (page > 1) this.buttonList.add(backPage); + if (page < Math.ceil(allButtons.size() / 7D)) this.buttonList.add(nextPage); + + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); + int pageWidth = mc.fontRendererObj.getStringWidth(pageText); + new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == goBack) { + mc.displayGuiScreen(new DankerGui(1, "")); + } else if (button == nextPage) { + mc.displayGuiScreen(new AlertsGui(page + 1)); + } else if (button == backPage) { + mc.displayGuiScreen(new AlertsGui(page - 1)); + } else if (button == add) { + mc.displayGuiScreen(new AlertAddGui()); + } else if (button == alerts) { + ToggleCommand.alerts = !ToggleCommand.alerts; + ConfigHandler.writeBooleanConfig("toggles", "Alerts", ToggleCommand.alerts); + alerts.displayString = "Alerts: " + Utils.getColouredBoolean(ToggleCommand.alerts); + } else { + mc.displayGuiScreen(new AlertActionGui(button.id)); + } + } + +} diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java new file mode 100644 index 0000000..df91f04 --- /dev/null +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java @@ -0,0 +1,118 @@ +package me.Danker.gui.crystalhollowwaypoints; + +import me.Danker.features.CrystalHollowWaypoints; +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; + +import java.io.IOException; + +public class CrystalHollowAddWaypointGui extends GuiScreen { + + private GuiButton cancel; + + private GuiTextField name; + private GuiButton curPos; + private GuiTextField x; + private GuiTextField y; + private GuiTextField z; + private GuiButton add; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + cancel = new GuiButton(0, 2, height - 30, 100, 20, "Cancel"); + + name = new GuiTextField(0, this.fontRendererObj, width / 2 - 100, (int) (height * 0.1), 200, 20); + curPos = new GuiButton(0, width / 2 - 50, (int) (height * 0.25), 100, 20, "Current Position"); + x = new GuiTextField(0, this.fontRendererObj, width / 2 - 85, (int) (height * 0.4), 50, 20); + y = new GuiTextField(0, this.fontRendererObj, width / 2 - 25, (int) (height * 0.4), 50, 20); + z = new GuiTextField(0, this.fontRendererObj, width / 2 + 35, (int) (height * 0.4), 50, 20); + add = new GuiButton(0, width / 2 - 25, (int) (height * 0.6), 50, 20, "Add"); + + name.setVisible(true); + name.setEnabled(true); + x.setVisible(true); + x.setEnabled(true); + y.setVisible(true); + y.setEnabled(true); + z.setVisible(true); + z.setEnabled(true); + + this.buttonList.add(cancel); + this.buttonList.add(curPos); + this.buttonList.add(add); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + name.drawTextBox(); + x.drawTextBox(); + y.drawTextBox(); + z.drawTextBox(); + + new TextRenderer(mc, "X:", width / 2 - 85, (int) (height * 0.35), 1D); + new TextRenderer(mc, "Y:", width / 2 - 25, (int) (height * 0.35), 1D); + new TextRenderer(mc, "Z:", width / 2 + 35, (int) (height * 0.35), 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + + if (button == cancel) { + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + } else if (button == curPos) { + x.setText(Integer.toString(player.getPosition().getX())); + y.setText(Integer.toString(player.getPosition().getY())); + z.setText(Integer.toString(player.getPosition().getZ())); + } else if (button == add) { + String loc = name.getText().length() == 0 ? Integer.toString(CrystalHollowWaypoints.waypoints.size()) : name.getText(); + int xPos = x.getText().matches("[-]?\\d+") ? Integer.parseInt(x.getText()) : player.getPosition().getX(); + int yPos = y.getText().matches("[-]?\\d+") ? Integer.parseInt(y.getText()) : player.getPosition().getY(); + int zPos = z.getText().matches("[-]?\\d+") ? Integer.parseInt(z.getText()) : player.getPosition().getZ(); + + BlockPos pos = new BlockPos(xPos, yPos, zPos); + CrystalHollowWaypoints.waypoints.add(new CrystalHollowWaypoints.Waypoint(loc, pos)); + + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + } + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + name.mouseClicked(mouseX, mouseY, mouseButton); + x.mouseClicked(mouseX, mouseY, mouseButton); + y.mouseClicked(mouseX, mouseY, mouseButton); + z.mouseClicked(mouseX, mouseY, mouseButton); + } + + @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException { + super.keyTyped(typedChar, keyCode); + name.textboxKeyTyped(typedChar, keyCode); + x.textboxKeyTyped(typedChar, keyCode); + y.textboxKeyTyped(typedChar, keyCode); + z.textboxKeyTyped(typedChar, keyCode); + } + +} diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java new file mode 100644 index 0000000..f792892 --- /dev/null +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java @@ -0,0 +1,95 @@ +package me.Danker.gui.crystalhollowwaypoints; + +import me.Danker.DankersSkyblockMod; +import me.Danker.features.CrystalHollowWaypoints; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; + +public class CrystalHollowWaypointActionGui extends GuiScreen { + + private int id; + + private GuiButton goBack; + private GuiButton toggle; + private GuiButton sendNormal; + private GuiButton sendDSM; + private GuiButton sendSBE; + private GuiButton delete; + + public CrystalHollowWaypointActionGui(int id) { + this.id = id; + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + toggle = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Set Visibility: " + Utils.getColouredBoolean(waypoint.toggled)); + sendNormal = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Send Location And Coordinates"); + sendDSM = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Send DSM Formatted Waypoint"); + sendSBE = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Send SBE Formatted Waypoint"); + delete = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), EnumChatFormatting.RED + "Delete Waypoint"); + + this.buttonList.add(toggle); + this.buttonList.add(sendNormal); + this.buttonList.add(sendDSM); + this.buttonList.add(sendSBE); + this.buttonList.add(delete); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); + + String waypointText = waypoint.location + " @ " + waypoint.getPos(); + int pageWidth = mc.fontRendererObj.getStringWidth(waypointText); + new TextRenderer(mc, waypointText, width / 2 - pageWidth / 2, 10, 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (button == goBack) { + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + DankersSkyblockMod.guiToOpen = "crystalwaypoints"; + } else if (button == toggle) { + waypoint.toggle(); + toggle.displayString = "Set Visibility: " + Utils.getColouredBoolean(waypoint.toggled); + } else if (button == sendNormal) { + player.sendChatMessage(waypoint.location + " @ " + waypoint.getPos()); + } else if (button == sendDSM) { + player.sendChatMessage("$DSMCHWP:" + waypoint.getFormattedWaypoint()); + } else if (button == sendSBE) { + player.sendChatMessage("$SBECHWP:" + waypoint.getFormattedWaypoint()); + } else if (button == delete) { + CrystalHollowWaypoints.waypoints.remove(id); + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + return; + } + CrystalHollowWaypoints.waypoints.set(id, waypoint); + } + +} diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java new file mode 100644 index 0000000..a3d0452 --- /dev/null +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java @@ -0,0 +1,145 @@ +package me.Danker.gui.crystalhollowwaypoints; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.features.CrystalHollowWaypoints; +import me.Danker.gui.DankerGui; +import me.Danker.gui.buttons.FeatureButton; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +import java.util.ArrayList; +import java.util.List; + +public class CrystalHollowWaypointsGui extends GuiScreen { + + private final int page; + private final List allButtons = new ArrayList<>(); + + private GuiButton goBack; + private GuiButton backPage; + private GuiButton nextPage; + private GuiButton sendDSM; + private GuiButton sendSBE; + private GuiButton add; + private FeatureButton crystalHollowWaypoints; + private FeatureButton crystalAutoWaypoints; + + public CrystalHollowWaypointsGui(int page) { + this.page = page; + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back"); + nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); + sendDSM = new GuiButton(0, 2, 10, 175, 20, "Send DSM Formatted Waypoints"); + sendSBE = new GuiButton(0, 2, 40, 175, 20, "Send SBE Formatted Waypoints"); + add = new GuiButton(0, 0, 0, "Add Waypoint"); + crystalHollowWaypoints = new FeatureButton("Crystal Hollows Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowWaypoints), "Shows waypoints to various places in the Crystal Hollows."); + crystalAutoWaypoints = new FeatureButton("Auto Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoWaypoints), "Automatically creates waypoints when you visit a special place in the Crystal Hollows."); + + allButtons.clear(); + allButtons.add(add); + allButtons.add(crystalHollowWaypoints); + allButtons.add(crystalAutoWaypoints); + for (int i = 0; i < CrystalHollowWaypoints.waypoints.size(); i++) { + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(i); + GuiButton button = new GuiButton(i, 0, 0, waypoint.location + " >"); + allButtons.add(button); + } + + reInit(); + } + + public void reInit() { + this.buttonList.clear(); + + for (int i = (page - 1) * 7, iteration = 0; iteration < 7 && i < allButtons.size(); i++, iteration++) { + GuiButton button = allButtons.get(i); + button.xPosition = width / 2 - 100; + button.yPosition = (int) (height * (0.1 * (iteration + 1))); + this.buttonList.add(button); + } + + if (page > 1) this.buttonList.add(backPage); + if (page < Math.ceil(allButtons.size() / 7D)) this.buttonList.add(nextPage); + + this.buttonList.add(goBack); + this.buttonList.add(sendDSM); + this.buttonList.add(sendSBE); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); + int pageWidth = mc.fontRendererObj.getStringWidth(pageText); + new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (button == goBack) { + mc.displayGuiScreen(new DankerGui(1, "")); + } else if (button == nextPage) { + mc.displayGuiScreen(new CrystalHollowWaypointsGui(page + 1)); + } else if (button == backPage) { + mc.displayGuiScreen(new CrystalHollowWaypointsGui(page - 1)); + } else if (button == sendDSM) { + if (CrystalHollowWaypoints.waypoints.size() > 0) { + StringBuilder message = new StringBuilder(); + for (CrystalHollowWaypoints.Waypoint waypoint : CrystalHollowWaypoints.waypoints) { + if (message.length() > 0) message.append("\\n"); + message.append(waypoint.getFormattedWaypoint()); + } + message.insert(0, "$DSMCHWP:"); + player.sendChatMessage(message.toString()); + } + } else if (button == sendSBE) { + if (CrystalHollowWaypoints.waypoints.size() > 0) { + StringBuilder message = new StringBuilder(); + for (CrystalHollowWaypoints.Waypoint waypoint : CrystalHollowWaypoints.waypoints) { + if (message.length() > 0) message.append("\\n"); + message.append(waypoint.getFormattedWaypoint()); + } + message.insert(0, "$SBECHWP:"); + player.sendChatMessage(message.toString()); + } + } else if (button == add) { + mc.displayGuiScreen(new CrystalHollowAddWaypointGui()); + } else if (button == crystalHollowWaypoints) { + ToggleCommand.crystalHollowWaypoints = !ToggleCommand.crystalHollowWaypoints; + ConfigHandler.writeBooleanConfig("toggles", "CrystalHollowWaypoints", ToggleCommand.crystalHollowWaypoints); + crystalHollowWaypoints.displayString = "Crystal Hollows Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowWaypoints); + } else if (button == crystalAutoWaypoints) { + ToggleCommand.crystalAutoWaypoints = !ToggleCommand.crystalAutoWaypoints; + ConfigHandler.writeBooleanConfig("toggles", "CrystalAutoWaypoints", ToggleCommand.crystalAutoWaypoints); + crystalAutoWaypoints.displayString = "Auto Waypoints: " + Utils.getColouredBoolean(ToggleCommand.crystalAutoWaypoints); + } else { + mc.displayGuiScreen(new CrystalHollowWaypointActionGui(button.id)); + } + } + +} diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 2a765ad..28f22fe 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,5 +1,8 @@ package me.Danker.handlers; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -13,7 +16,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; -import java.io.File; +import java.io.*; +import java.util.ArrayList; +import java.util.Arrays; public class ConfigHandler { public static Configuration config; @@ -220,15 +225,6 @@ public class ConfigHandler { ToggleCommand.crystalAutoWaypoints = initBoolean("toggles", "CrystalAutoWaypoints", true); // enabled by default ToggleCommand.autoAcceptReparty = initBoolean("toggles", "AutoAcceptReparty", false); ToggleCommand.abilityCooldowns = initBoolean("toggles", "AbilityCooldowns", false); - // Chat Messages - ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); - ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); - ToggleCommand.implosionMessages = initBoolean("toggles", "ImplosionMessages", true); - ToggleCommand.healMessages = initBoolean("toggles", "HealMessages", true); - ToggleCommand.cooldownMessages = initBoolean("toggles", "CooldownMessages", true); - ToggleCommand.manaMessages = initBoolean("toggles", "ManaMessages", true); - ToggleCommand.killComboMessages = initBoolean("toggles", "KillComboMessages", true); - // Dungeons ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "DungeonTimer", false); ToggleCommand.lowHealthNotifyToggled = initBoolean("toggles", "LowHealthNotify", false); ToggleCommand.lividSolverToggled = initBoolean("toggles", "LividSolver", false); @@ -239,7 +235,16 @@ public class ConfigHandler { ToggleCommand.bonzoTimerToggled = initBoolean("toggles", "BonzoTimer", false); ToggleCommand.swapToPickBlockToggled = initBoolean("toggles", "PickBlock", false); ToggleCommand.flowerWeaponsToggled = initBoolean("toggles", "FlowerWeapons", false); - ToggleCommand.autoSkillTrackerToggled = initBoolean("toggles", "AutoSkillTracker", false); + ToggleCommand.autoSkillTrackerToggled = initBoolean("toggles", "AutoSkillTracker", false); + ToggleCommand.alerts = initBoolean("toggles", "Alerts", false); + // Chat Messages + ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); + ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); + ToggleCommand.implosionMessages = initBoolean("toggles", "ImplosionMessages", true); + ToggleCommand.healMessages = initBoolean("toggles", "HealMessages", true); + ToggleCommand.cooldownMessages = initBoolean("toggles", "CooldownMessages", true); + ToggleCommand.manaMessages = initBoolean("toggles", "ManaMessages", true); + ToggleCommand.killComboMessages = initBoolean("toggles", "KillComboMessages", true); // Puzzle Solvers ToggleCommand.threeManToggled = initBoolean("toggles", "ThreeManPuzzle", false); ToggleCommand.oruoToggled = initBoolean("toggles", "OruoPuzzle", false); @@ -616,6 +621,21 @@ public class ConfigHandler { // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); + + // JSON + Gson gson = new Gson(); + + try { + if (!(new File(Alerts.configFile).exists())) { + FileWriter file = new FileWriter(Alerts.configFile); + file.write(new JsonArray().toString()); + file.close(); + } + Alerts.Alert[] alerts = gson.fromJson(new FileReader(Alerts.configFile), Alerts.Alert[].class); + if (alerts != null) Alerts.alerts = new ArrayList<>(Arrays.asList(alerts)); + } catch (IOException ex) { + ex.printStackTrace(); + } } } -- cgit From dda83961a0922b5753c7d4dd3e239a925d3afa7a Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 26 Dec 2021 21:57:22 -0500 Subject: Add master mode loot tracker --- README.md | 4 +- .../java/me/Danker/commands/DisplayCommand.java | 11 +- src/main/java/me/Danker/commands/LootCommand.java | 37 +++++- src/main/java/me/Danker/features/AutoDisplay.java | 2 + .../me/Danker/features/loot/CatacombsTracker.java | 125 ++++++++++++++++----- .../java/me/Danker/features/loot/LootDisplay.java | 48 ++++++++ src/main/java/me/Danker/gui/DisplayGui.java | 62 +++++----- .../java/me/Danker/handlers/ConfigHandler.java | 10 ++ 8 files changed, 236 insertions(+), 63 deletions(-) (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/README.md b/README.md index 4b4802c..d613908 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,8 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/f(1-7)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /loot [winter/festival/spooky/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index e248888..d335a8a 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/session/f(1-7)]"; + return "/" + getCommandName() + " [winter/festival/spooky/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -40,7 +40,7 @@ public class DisplayCommand extends CommandBase { } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { - return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7"); + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { return getListOfStringsMatchingLastWord(args, "session"); } @@ -198,6 +198,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "catacombs_floor_seven"; } break; + case "mm": + case "master": + if (showSession) { + LootDisplay.display = "catacombs_master_session"; + } else { + LootDisplay.display = "catacombs_master"; + } default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /display catacombs ")); return; diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 617a957..1437b36 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/f(1-7)/session]"; + return "/" + getCommandName() + " [winter/festival/spooky/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -43,7 +43,7 @@ public class LootCommand extends CommandBase { } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { - return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7"); + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { return getListOfStringsMatchingLastWord(args, "session"); } @@ -803,6 +803,39 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, CatacombsTracker.f7TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); break; + case "mm": + case "master": + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs MM Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " S Runs:" + nf.format(CatacombsTracker.masterSSession) + "\n" + + EnumChatFormatting.GOLD + " Recombobulators:" + nf.format(CatacombsTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books:" + nf.format(CatacombsTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 1st Master Stars:" + nf.format(CatacombsTracker.firstStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 2nd Master Stars:" + nf.format(CatacombsTracker.secondStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 3rd Master Stars:" + nf.format(CatacombsTracker.thirdStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 4th Master Stars:" + nf.format(CatacombsTracker.fourthStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 5th Master Stars:" + nf.format(CatacombsTracker.fifthStarsSession) + "\n" + + EnumChatFormatting.WHITE + " Rerolls:" + nf.format(CatacombsTracker.masterRerollsSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent:" + nf.format(CatacombsTracker.masterCoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent:" + nf.format(CatacombsTracker.masterTimeSpentSession) + "\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); + return; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs MM Summary:\n" + + EnumChatFormatting.GOLD + " S Runs:" + nf.format(CatacombsTracker.masterS) + "\n" + + EnumChatFormatting.GOLD + " Recombobulators:" + nf.format(CatacombsTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books:" + nf.format(CatacombsTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 1st Master Stars:" + nf.format(CatacombsTracker.firstStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 2nd Master Stars:" + nf.format(CatacombsTracker.secondStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 3rd Master Stars:" + nf.format(CatacombsTracker.thirdStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 4th Master Stars:" + nf.format(CatacombsTracker.fourthStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + " 5th Master Stars:" + nf.format(CatacombsTracker.fifthStars) + "\n" + + EnumChatFormatting.WHITE + " Rerolls:" + nf.format(CatacombsTracker.masterRerolls) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent:" + nf.format(CatacombsTracker.masterCoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent:" + nf.format(CatacombsTracker.masterTimeSpent) + "\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /loot catacombs ")); } diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 89b1750..8dbe359 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -59,6 +59,8 @@ public class AutoDisplay { LootDisplay.display = "catacombs_floor_six"; } else if (sCleaned.contains("F7")) { LootDisplay.display = "catacombs_floor_seven"; + } else if (sCleaned.contains("(M")) { + LootDisplay.display = "catacombs_master"; } found = true; } diff --git a/src/main/java/me/Danker/features/loot/CatacombsTracker.java b/src/main/java/me/Danker/features/loot/CatacombsTracker.java index ddcb7d5..86770d6 100644 --- a/src/main/java/me/Danker/features/loot/CatacombsTracker.java +++ b/src/main/java/me/Danker/features/loot/CatacombsTracker.java @@ -88,6 +88,16 @@ public class CatacombsTracker { public static int f7Rerolls; public static double f7CoinsSpent; public static double f7TimeSpent; + // MM + public static int masterS; + public static int firstStars; + public static int secondStars; + public static int thirdStars; + public static int fourthStars; + public static int fifthStars; + public static int masterRerolls; + public static double masterCoinsSpent; + public static double masterTimeSpent; // Catacombs Dungeons public static int recombobulatorsSession = 0; @@ -163,6 +173,16 @@ public class CatacombsTracker { public static int f7RerollsSession = 0; public static double f7CoinsSpentSession = 0; public static double f7TimeSpentSession = 0; + // MM + public static int masterSSession = 0; + public static int firstStarsSession = 0; + public static int secondStarsSession = 0; + public static int thirdStarsSession = 0; + public static int fourthStarsSession = 0; + public static int fifthStarsSession = 0; + public static int masterRerollsSession = 0; + public static double masterCoinsSpentSession = 0; + public static double masterTimeSpentSession = 0; @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { @@ -173,37 +193,48 @@ public class CatacombsTracker { if (message.contains(" Team Score: ") && message.contains("(S+)")) { List scoreboard = ScoreboardHandler.getSidebarLines(); - for (String s : scoreboard) { - String sCleaned = ScoreboardHandler.cleanSB(s); - if (sCleaned.contains("The Catacombs (")) { - if (sCleaned.contains("F1")) { - f1SPlus++; - f1SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorOneSPlus", f1SPlus); - } else if (sCleaned.contains("F2")) { - f2SPlus++; - f2SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorTwoSPlus", f2SPlus); - } else if (sCleaned.contains("F3")) { - f3SPlus++; - f3SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorThreeSPlus", f3SPlus); - } else if (sCleaned.contains("F4")) { - f4SPlus++; - f4SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorFourSPlus", f4SPlus); - } else if (sCleaned.contains("F5")) { - f5SPlus++; - f5SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorFiveSPlus", f5SPlus); - } else if (sCleaned.contains("F6")) { - f6SPlus++; - f6SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorSixSPlus", f6SPlus); - } else if (sCleaned.contains("F7")) { - f7SPlus++; - f7SPlusSession++; - ConfigHandler.writeIntConfig("catacombs", "floorSevenSPlus", f7SPlus); + if (message.contains("(S+)")) { + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (")) { + if (sCleaned.contains("F1")) { + f1SPlus++; + f1SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorOneSPlus", f1SPlus); + } else if (sCleaned.contains("F2")) { + f2SPlus++; + f2SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorTwoSPlus", f2SPlus); + } else if (sCleaned.contains("F3")) { + f3SPlus++; + f3SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorThreeSPlus", f3SPlus); + } else if (sCleaned.contains("F4")) { + f4SPlus++; + f4SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorFourSPlus", f4SPlus); + } else if (sCleaned.contains("F5")) { + f5SPlus++; + f5SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorFiveSPlus", f5SPlus); + } else if (sCleaned.contains("F6")) { + f6SPlus++; + f6SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorSixSPlus", f6SPlus); + } else if (sCleaned.contains("F7")) { + f7SPlus++; + f7SPlusSession++; + ConfigHandler.writeIntConfig("catacombs", "floorSevenSPlus", f7SPlus); + } + } + } + } else if (message.contains("(S)")) { + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (M")) { + masterS++; + masterSSession++; + ConfigHandler.writeIntConfig("catacombs", "masterS", masterS); } } } @@ -384,6 +415,26 @@ public class CatacombsTracker { witherBoots++; witherBootsSession++; ConfigHandler.writeIntConfig("catacombs", "witherBoot", witherBoots); + } else if (message.contains("First Master Star")) { + firstStars++; + firstStarsSession++; + ConfigHandler.writeIntConfig("catacombs", "firstStar", firstStars); + } else if (message.contains("Second Master Star")) { + secondStars++; + secondStarsSession++; + ConfigHandler.writeIntConfig("catacombs", "secondStar", secondStars); + } else if (message.contains("Third Master Star")) { + thirdStars++; + thirdStarsSession++; + ConfigHandler.writeIntConfig("catacombs", "thirdStar", thirdStars); + } else if (message.contains("Fourth Master Star")) { + fourthStars++; + fourthStarsSession++; + ConfigHandler.writeIntConfig("catacombs", "fourthStar", fourthStars); + } else if (message.contains("Fifth Master Star")) { + fifthStars++; + fifthStarsSession++; + ConfigHandler.writeIntConfig("catacombs", "fifthStar", fifthStars); } } @@ -422,6 +473,10 @@ public class CatacombsTracker { f7TimeSpent = Math.floor(f7TimeSpent + timeToAdd); f7TimeSpentSession = Math.floor(f7TimeSpentSession + timeToAdd); ConfigHandler.writeDoubleConfig("catacombs", "floorSevenTime", f7TimeSpent); + } else if (sCleaned.contains("(M")) { + masterTimeSpent = Math.floor(masterTimeSpent + timeToAdd); + masterTimeSpentSession = Math.floor(masterTimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "masterTime", masterTimeSpent); } } else if (sCleaned.contains("Time Elapsed:")) { // Get floor time @@ -481,6 +536,10 @@ public class CatacombsTracker { f7CoinsSpent += coinsSpent; f7CoinsSpentSession += coinsSpent; ConfigHandler.writeDoubleConfig("catacombs", "floorSevenCoins", f7CoinsSpent); + } else if (sCleaned.contains("(M")) { + masterCoinsSpent += coinsSpent; + masterCoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "masterCoins", masterCoinsSpent); } } break; @@ -500,6 +559,10 @@ public class CatacombsTracker { f7Rerolls++; f7RerollsSession++; ConfigHandler.writeDoubleConfig("catacombs", "floorSevenRerolls", f7Rerolls); + } else if (sCleaned.contains("(M")) { + masterRerolls++; + masterRerollsSession++; + ConfigHandler.writeDoubleConfig("catacombs", "masterRerolls", masterRerolls); } break; } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index d7a5f74..1878b47 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -1064,6 +1064,54 @@ public class LootDisplay { EnumChatFormatting.AQUA + Utils.getMoneySpent(CatacombsTracker.f7CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, CatacombsTracker.f7TimeSpentSession); break; + case "catacombs_master": + dropsText = EnumChatFormatting.GOLD + "S Runs:\n" + + EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "1st Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "2nd Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "3rd Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "4th Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "5th Master Stars:\n" + + EnumChatFormatting.WHITE + "Rerolls:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(CatacombsTracker.masterS) + "\n" + + EnumChatFormatting.GOLD + nf.format(CatacombsTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.firstStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.secondStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.thirdStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.fourthStars) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.fifthStars) + "\n" + + EnumChatFormatting.WHITE + nf.format(CatacombsTracker.masterRerolls) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(CatacombsTracker.masterCoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, CatacombsTracker.masterTimeSpent); + break; + case "catacombs_master_session": + dropsText = EnumChatFormatting.GOLD + "S Runs:\n" + + EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "1st Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "2nd Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "3rd Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "4th Master Stars:\n" + + EnumChatFormatting.DARK_PURPLE + "5th Master Stars:\n" + + EnumChatFormatting.WHITE + "Rerolls:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(CatacombsTracker.masterSSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(CatacombsTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.firstStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.secondStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.thirdStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.fourthStarsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(CatacombsTracker.fifthStarsSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(CatacombsTracker.masterRerollsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(CatacombsTracker.masterCoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, CatacombsTracker.masterTimeSpentSession); + break; case "ghost_session": dropsText = EnumChatFormatting.GOLD + "Bags of Cash:\n" + EnumChatFormatting.BLUE + "Sorrows:\n" + diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index c6b1381..06239b1 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -34,6 +34,7 @@ public class DisplayGui extends GuiScreen { private GuiButton catacombsF5; private GuiButton catacombsF6; private GuiButton catacombsF7; + private GuiButton catacombsMM; private GuiButton ghost; @Override @@ -63,13 +64,14 @@ public class DisplayGui extends GuiScreen { fishingSpooky = new GuiButton(0, width / 2 + 130, (int) (height * 0.4), 100, 20, "Fishing Spooky"); mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), 95, 20, "Mythological"); ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 95, 20, "Ghost"); - catacombsF1 = new GuiButton(0, width / 2 - 205, (int) (height * 0.65), 50, 20, "F1"); - catacombsF2 = new GuiButton(0, width / 2 - 145, (int) (height * 0.65), 50, 20, "F2"); - catacombsF3 = new GuiButton(0, width / 2 - 85, (int) (height * 0.65), 50, 20, "F3"); - catacombsF4 = new GuiButton(0, width / 2 - 25, (int) (height * 0.65), 50, 20, "F4"); - catacombsF5 = new GuiButton(0, width / 2 + 35, (int) (height * 0.65), 50, 20, "F5"); - catacombsF6 = new GuiButton(0, width / 2 + 95, (int) (height * 0.65), 50, 20, "F6"); - catacombsF7 = new GuiButton(0, width / 2 + 155, (int) (height * 0.65), 50, 20, "F7"); + catacombsF1 = new GuiButton(0, width / 2 - 235, (int) (height * 0.65), 50, 20, "F1"); + catacombsF2 = new GuiButton(0, width / 2 - 175, (int) (height * 0.65), 50, 20, "F2"); + catacombsF3 = new GuiButton(0, width / 2 - 115, (int) (height * 0.65), 50, 20, "F3"); + catacombsF4 = new GuiButton(0, width / 2 - 55, (int) (height * 0.65), 50, 20, "F4"); + catacombsF5 = new GuiButton(0, width / 2 + 5, (int) (height * 0.65), 50, 20, "F5"); + catacombsF6 = new GuiButton(0, width / 2 + 65, (int) (height * 0.65), 50, 20, "F6"); + catacombsF7 = new GuiButton(0, width / 2 + 125, (int) (height * 0.65), 50, 20, "F7"); + catacombsMM = new GuiButton(0, width / 2 + 185, (int) (height * 0.65), 50, 20, "MM"); this.buttonList.add(showSession); this.buttonList.add(off); @@ -90,6 +92,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(catacombsF5); this.buttonList.add(catacombsF6); this.buttonList.add(catacombsF7); + this.buttonList.add(catacombsMM); this.buttonList.add(ghost); this.buttonList.add(goBack); } @@ -125,44 +128,47 @@ public class DisplayGui extends GuiScreen { } else if (button == off) { setDisplay("off", true); } else if (button == zombie) { - setDisplay("zombie", false); + setDisplay("zombie"); } else if (button == spider) { - setDisplay("spider", false); + setDisplay("spider"); } else if (button == wolf) { - setDisplay("wolf", false); + setDisplay("wolf"); } else if (button == enderman) { - setDisplay("enderman", false); + setDisplay("enderman"); } else if (button == auto) { LootDisplay.auto = true; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); } else if (button == fishing) { - setDisplay("fishing", false); + setDisplay("fishing"); } else if (button == fishingWinter) { - setDisplay("fishing_winter", false); + setDisplay("fishing_winter"); } else if (button == fishingFestival) { - setDisplay("fishing_festival", false); + setDisplay("fishing_festival"); } else if (button == fishingSpooky) { - setDisplay("fishing_spooky", false); + setDisplay("fishing_spooky"); } else if (button == mythological) { - setDisplay("mythological", false); + setDisplay("mythological"); } else if (button == catacombsF1) { - setDisplay("catacombs_floor_one", false); + setDisplay("catacombs_floor_one"); } else if (button == catacombsF2) { - setDisplay("catacombs_floor_two", false); + setDisplay("catacombs_floor_two"); } else if (button == catacombsF3) { - setDisplay("catacombs_floor_three", false); + setDisplay("catacombs_floor_three"); } else if (button == catacombsF4) { - setDisplay("catacombs_floor_four", false); + setDisplay("catacombs_floor_four"); } else if (button == catacombsF5) { - setDisplay("catacombs_floor_five", false); + setDisplay("catacombs_floor_five"); } else if (button == catacombsF6) { - setDisplay("catacombs_floor_six", false); + setDisplay("catacombs_floor_six"); } else if (button == catacombsF7) { - setDisplay("catacombs_floor_seven", false); - } else if (button == ghost) - setDisplay("ghost",false); + setDisplay("catacombs_floor_seven"); + } else if (button == catacombsMM) { + setDisplay("catacombs_master"); + } else if (button == ghost) { + setDisplay("ghost"); + } } - + public void setDisplay(String display, boolean forceNoSession) { if (!forceNoSession && addSession) display += "_session"; LootDisplay.auto = false; @@ -170,5 +176,9 @@ public class DisplayGui extends GuiScreen { ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); ConfigHandler.writeStringConfig("misc", "display", display); } + + public void setDisplay(String display) { + setDisplay(display, false); + } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index c785ff1..112d86d 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -504,6 +504,16 @@ public class ConfigHandler { CatacombsTracker.f7Rerolls = initInt("catacombs", "floorSevenRerolls", 0); CatacombsTracker.f7CoinsSpent = initDouble("catacombs", "floorSevenCoins", 0); CatacombsTracker.f7TimeSpent = initDouble("catacombs", "floorSevenTime", 0); + // MM + CatacombsTracker.masterS = initInt("catacombs", "masterS", 0); + CatacombsTracker.firstStars = initInt("catacombs", "firstStar", 0); + CatacombsTracker.secondStars = initInt("catacombs", "secondStar", 0); + CatacombsTracker.thirdStars = initInt("catacombs", "thirdStar", 0); + CatacombsTracker.fourthStars = initInt("catacombs", "fourthStar", 0); + CatacombsTracker.fifthStars = initInt("catacombs", "fifthStar", 0); + CatacombsTracker.masterRerolls = initInt("catacombs", "masterRerolls", 0); + CatacombsTracker.masterCoinsSpent = initDouble("catacombs", "masterCoins", 0); + CatacombsTracker.masterTimeSpent = initDouble("catacombs", "masterTime", 0); // Ghost GhostTracker.sorrows = initInt("ghosts", "sorrow", 0); -- cgit From 2b57ccad6d21b325c3164117fe14e00e13399a7c Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 4 Mar 2022 13:20:20 -0500 Subject: Add CH fishing tracker Organized change display GUI Add method to make centered text rendering easier --- README.md | 6 +- .../java/me/Danker/commands/DisplayCommand.java | 11 +- .../me/Danker/commands/ImportFishingCommand.java | 116 ++++++++++++++------- src/main/java/me/Danker/commands/LootCommand.java | 28 ++++- .../java/me/Danker/commands/ResetLootCommand.java | 6 ++ .../me/Danker/features/loot/FishingTracker.java | 44 ++++++++ .../java/me/Danker/features/loot/LootDisplay.java | 44 ++++++++ src/main/java/me/Danker/gui/DankerGui.java | 4 +- src/main/java/me/Danker/gui/DisplayGui.java | 51 +++++---- src/main/java/me/Danker/gui/OnlySlayerGui.java | 4 +- src/main/java/me/Danker/gui/SkillTrackerGui.java | 6 +- src/main/java/me/Danker/gui/WarningGui.java | 16 ++- .../java/me/Danker/gui/alerts/AlertActionGui.java | 2 + src/main/java/me/Danker/gui/alerts/AlertsGui.java | 4 +- .../CrystalHollowWaypointActionGui.java | 5 +- .../CrystalHollowWaypointsGui.java | 4 +- .../java/me/Danker/handlers/ConfigHandler.java | 7 ++ src/main/java/me/Danker/utils/RenderUtils.java | 6 ++ 18 files changed, 272 insertions(+), 92 deletions(-) (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/README.md b/README.md index 8e31daa..4ae2a40 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Discord Server: https://discord.gg/QsEkNQS - Maddox menu keybind - Block starting other slayer quests - Slayer slain alert -- Fishing, jerry fishing, fishing festival, spooky fishing trackers +- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing trackers - Expertise kills in fishing rod lore - Gemstones applied in item lore - Catacombs trackers @@ -70,8 +70,8 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/festival/spooky/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /loot [winter/festival/spooky/ch/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/ch/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index d335a8a..3db6853 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/session/f(1-7)/mm]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -113,6 +113,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "fishing_spooky"; } break; + case "ch": + if (showSession) { + LootDisplay.display = "fishing_ch"; + } else { + LootDisplay.display = "fishing_ch_session"; + } + break; default: if (showSession) { LootDisplay.display = "fishing_session"; diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 3ee5ebd..bdd3281 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -37,22 +37,22 @@ public class ImportFishingCommand extends CommandBase { // MULTI THREAD DRIFTING new Thread(() -> { EntityPlayer player = (EntityPlayer) arg0; - + // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); return; } - + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Importing your fishing stats...")); - + // Get UUID for Hypixel API requests String uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - + String latestProfile = APIHandler.getLatestProfileID(uuid, key); if (latestProfile == null) return; - + String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key; System.out.println("Fetching profile..."); JsonObject profileResponse = APIHandler.getResponse(profileURL, true); @@ -61,10 +61,10 @@ public class ImportFishingCommand extends CommandBase { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } - + System.out.println("Fetching fishing stats..."); JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject(); - + FishingTracker.greatCatches = 0; FishingTracker.goodCatches = 0; if (statsObject.has("items_fished_treasure")) { @@ -75,44 +75,44 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.goodCatches = statsObject.get("items_fished_treasure").getAsInt(); } } - + FishingTracker.seaCreatures = 0; FishingTracker.squids = 0; if (statsObject.has("kills_pond_squid")) { FishingTracker.squids = statsObject.get("kills_pond_squid").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.squids; - + FishingTracker.seaWalkers = 0; if (statsObject.has("kills_sea_walker")) { FishingTracker.seaWalkers = statsObject.get("kills_sea_walker").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaWalkers; - + FishingTracker.nightSquids = 0; if (statsObject.has("kills_night_squid")) { FishingTracker.nightSquids = statsObject.get("kills_night_squid").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.nightSquids; - + FishingTracker.seaGuardians = 0; if (statsObject.has("kills_sea_guardian")) { FishingTracker.seaGuardians = statsObject.get("kills_sea_guardian").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaGuardians; - + FishingTracker.seaWitches = 0; if (statsObject.has("kills_sea_witch")) { FishingTracker.seaWitches = statsObject.get("kills_sea_witch").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaWitches; - + FishingTracker.seaArchers = 0; if (statsObject.has("kills_sea_archer")) { FishingTracker.seaArchers = statsObject.get("kills_sea_archer").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaArchers; - + FishingTracker.monsterOfTheDeeps = 0; if (statsObject.has("kills_zombie_deep")) { if (statsObject.has("kills_chicken_deep")) { @@ -124,44 +124,44 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.monsterOfTheDeeps = statsObject.get("kills_chicken_deep").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.monsterOfTheDeeps; - + FishingTracker.catfishes = 0; if (statsObject.has("kills_catfish")) { FishingTracker.catfishes = statsObject.get("kills_catfish").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.catfishes; - + FishingTracker.carrotKings = 0; if (statsObject.has("kills_carrot_king")) { FishingTracker.carrotKings = statsObject.get("kills_carrot_king").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.carrotKings; - + FishingTracker.seaLeeches = 0; if (statsObject.has("kills_sea_leech")) { FishingTracker.seaLeeches = statsObject.get("kills_sea_leech").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaLeeches; - + FishingTracker.guardianDefenders = 0; if (statsObject.has("kills_guardian_defender")) { FishingTracker.guardianDefenders = statsObject.get("kills_guardian_defender").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.guardianDefenders; - + FishingTracker.deepSeaProtectors = 0; if (statsObject.has("kills_deep_sea_protector")) { FishingTracker.deepSeaProtectors = statsObject.get("kills_deep_sea_protector").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.deepSeaProtectors; - + FishingTracker.hydras = 0; if (statsObject.has("kills_water_hydra")) { // Hydra splits FishingTracker.hydras = statsObject.get("kills_water_hydra").getAsInt() / 2; } FishingTracker.seaCreatures += FishingTracker.hydras; - + FishingTracker.seaEmperors = 0; if (statsObject.has("kills_skeleton_emperor")) { if (statsObject.has("kills_guardian_emperor")) { @@ -173,90 +173,126 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.seaEmperors = statsObject.get("kills_guardian_emperor").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaEmperors; - + FishingTracker.fishingMilestone = 0; if (statsObject.has("pet_milestone_sea_creatures_killed")) { FishingTracker.fishingMilestone = statsObject.get("pet_milestone_sea_creatures_killed").getAsInt(); } - + FishingTracker.frozenSteves = 0; if (statsObject.has("kills_frozen_steve")) { FishingTracker.frozenSteves = statsObject.get("kills_frozen_steve").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.frozenSteves; - + FishingTracker.frostyTheSnowmans = 0; if (statsObject.has("kills_frosty_the_snowman")) { FishingTracker.frostyTheSnowmans = statsObject.get("kills_frosty_the_snowman").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.frostyTheSnowmans; - + FishingTracker.grinches = 0; if (statsObject.has("kills_grinch")) { FishingTracker.grinches = statsObject.get("kills_grinch").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.grinches; - + FishingTracker.yetis = 0; if (statsObject.has("kills_yeti")) { FishingTracker.yetis = statsObject.get("kills_yeti").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.yetis; - + FishingTracker.nurseSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.nurseSharks = statsObject.get("kills_nurse_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.nurseSharks; - + FishingTracker.blueSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.blueSharks = statsObject.get("kills_blue_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.blueSharks; - + FishingTracker.tigerSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.tigerSharks = statsObject.get("kills_tiger_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.tigerSharks; - + FishingTracker.greatWhiteSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.greatWhiteSharks = statsObject.get("kills_great_white_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.greatWhiteSharks; - + FishingTracker.scarecrows = 0; if (statsObject.has("kills_scarecrow")) { FishingTracker.scarecrows = statsObject.get("kills_scarecrow").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.scarecrows; - + FishingTracker.nightmares = 0; if (statsObject.has("kills_nightmare")) { FishingTracker.nightmares = statsObject.get("kills_nightmare").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.nightmares; - + FishingTracker.werewolfs = 0; if (statsObject.has("kills_werewolf")) { FishingTracker.werewolfs = statsObject.get("kills_werewolf").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.werewolfs; - + FishingTracker.phantomFishers = 0; if (statsObject.has("kills_phantom_fisherman")) { FishingTracker.phantomFishers = statsObject.get("kills_phantom_fisherman").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.phantomFishers; - + FishingTracker.grimReapers = 0; if (statsObject.has("kills_grim_reaper")) { FishingTracker.grimReapers = statsObject.get("kills_grim_reaper").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.grimReapers; - + + FishingTracker.waterWorms = 0; + if (statsObject.has("kills_water_worm")) { + FishingTracker.waterWorms = statsObject.get("kills_water_worm").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.waterWorms; + + FishingTracker.poisonedWaterWorms = 0; + if (statsObject.has("kills_poisoned_water_worm")) { + FishingTracker.poisonedWaterWorms = statsObject.get("kills_poisoned_water_worm").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.poisonedWaterWorms; + + FishingTracker.flamingWorms = 0; + if (statsObject.has("kills_flaming_worm")) { + FishingTracker.flamingWorms = statsObject.get("kills_flaming_worm").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.flamingWorms; + + FishingTracker.lavaBlazes = 0; + if (statsObject.has("kills_lava_blaze")) { + FishingTracker.lavaBlazes = statsObject.get("kills_lava_blaze").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.lavaBlazes; + + FishingTracker.lavaPigmen = 0; + if (statsObject.has("kills_lava_pigman")) { + FishingTracker.lavaPigmen = statsObject.get("kills_lava_pigman").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.lavaPigmen; + + FishingTracker.zombieMiners = 0; + if (statsObject.has("kills_zombie_miner")) { + FishingTracker.zombieMiners = statsObject.get("kills_zombie_miner").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.zombieMiners; + System.out.println("Writing to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); ConfigHandler.writeIntConfig("fishing", "greatCatch", FishingTracker.greatCatches); @@ -289,7 +325,13 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "werewolf", FishingTracker.werewolfs); ConfigHandler.writeIntConfig("fishing", "phantomFisher", FishingTracker.phantomFishers); ConfigHandler.writeIntConfig("fishing", "grimReaper", FishingTracker.grimReapers); - + ConfigHandler.writeIntConfig("fishing", "waterWorm", FishingTracker.waterWorms); + ConfigHandler.writeIntConfig("fishing", "poisonedWaterWorm", FishingTracker.poisonedWaterWorms); + ConfigHandler.writeIntConfig("fishing", "flamingWorm", FishingTracker.flamingWorms); + ConfigHandler.writeIntConfig("fishing", "lavaBlaze", FishingTracker.lavaBlazes); + ConfigHandler.writeIntConfig("fishing", "lavaPigman", FishingTracker.lavaPigmen); + ConfigHandler.writeIntConfig("fishing", "zombieMiner", FishingTracker.zombieMiners); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 1437b36..2a647c6 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/f(1-7)/mm/session]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +41,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -451,6 +451,30 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Phantom Fishers: " + nf.format(FishingTracker.phantomFishers) + "\n" + EnumChatFormatting.GOLD + " Grim Reapers: " + nf.format(FishingTracker.grimReapers) + "\n" + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); + } else if (arg1[1].equalsIgnoreCase("ch")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Crystal Hollows Fishing Summary:\n" + + EnumChatFormatting.BLUE + " Water Worms: " + nf.format(FishingTracker.waterWormsSession) + "\n" + + EnumChatFormatting.GREEN + " Poisoned Water Worms: " + nf.format(FishingTracker.poisonedWaterWormsSession) + "\n" + + EnumChatFormatting.RED + " Flaming Worms: " + nf.format(FishingTracker.flamingWormsSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Blazes: " + nf.format(FishingTracker.lavaBlazesSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Pigmen: " + nf.format(FishingTracker.lavaPigmenSession) + "\n" + + EnumChatFormatting.GOLD + " Zombie Miners: " + nf.format(FishingTracker.zombieMinersSession) + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); + + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Crystal Hollows Fishing Summary:\n" + + EnumChatFormatting.BLUE + " Water Worms: " + nf.format(FishingTracker.waterWorms) + "\n" + + EnumChatFormatting.GREEN + " Poisoned Water Worms: " + nf.format(FishingTracker.poisonedWaterWorms) + "\n" + + EnumChatFormatting.RED + " Flaming Worms: " + nf.format(FishingTracker.flamingWorms) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Blazes: " + nf.format(FishingTracker.lavaBlazes) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Pigmen: " + nf.format(FishingTracker.lavaPigmen) + "\n" + + EnumChatFormatting.GOLD + " Zombie Miners: " + nf.format(FishingTracker.zombieMiners) + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 2c5c947..cca7dda 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -238,6 +238,12 @@ public class ResetLootCommand extends CommandBase { FishingTracker.werewolfsSession = 0; FishingTracker.phantomFishersSession = 0; FishingTracker.grimReapersSession = 0; + FishingTracker.waterWorms = 0; + FishingTracker.poisonedWaterWorms = 0; + FishingTracker.flamingWorms = 0; + FishingTracker.lavaBlazes = 0; + FishingTracker.lavaPigmen = 0; + FishingTracker.zombieMiners = 0; ConfigHandler.deleteCategory("fishing"); ConfigHandler.reloadConfig(); } diff --git a/src/main/java/me/Danker/features/loot/FishingTracker.java b/src/main/java/me/Danker/features/loot/FishingTracker.java index c54f943..cf329aa 100644 --- a/src/main/java/me/Danker/features/loot/FishingTracker.java +++ b/src/main/java/me/Danker/features/loot/FishingTracker.java @@ -47,6 +47,13 @@ public class FishingTracker { public static int werewolfs; public static int phantomFishers; public static int grimReapers; + // CH Fishing + public static int waterWorms; + public static int poisonedWaterWorms; + public static int flamingWorms; + public static int lavaBlazes; + public static int lavaPigmen; + public static int zombieMiners; // Fishing public static int seaCreaturesSession = 0; @@ -87,6 +94,13 @@ public class FishingTracker { public static int werewolfsSession = 0; public static int phantomFishersSession = 0; public static int grimReapersSession = 0; + // CH Fishing + public static int waterWormsSession = 0; + public static int poisonedWaterWormsSession = 0; + public static int flamingWormsSession = 0; + public static int lavaBlazesSession = 0; + public static int lavaPigmenSession = 0; + public static int zombieMinersSession = 0; @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { @@ -252,6 +266,36 @@ public class FishingTracker { grimReapersSession++; ConfigHandler.writeIntConfig("fishing", "grimReaper", grimReapers); increaseSeaCreatures(); + } else if (message.contains("A Water Worm surfaces")) { + waterWorms++; + waterWormsSession++; + ConfigHandler.writeIntConfig("fishing", "waterWorm", waterWorms); + increaseSeaCreatures(); + } else if (message.contains("A Poisoned Water Worm surfaces")) { + poisonedWaterWorms++; + poisonedWaterWormsSession++; + ConfigHandler.writeIntConfig("fishing", "poisonedWaterWorm", poisonedWaterWorms); + increaseSeaCreatures(); + } else if (message.contains("A flaming worm surfaces from the depths")) { + flamingWorms++; + flamingWormsSession++; + ConfigHandler.writeIntConfig("fishing", "flamingWorm", flamingWorms); + increaseSeaCreatures(); + } else if (message.contains("A Lava Blaze has surfaced from the depths")) { + lavaBlazes++; + lavaBlazesSession++; + ConfigHandler.writeIntConfig("fishing", "lavaBlaze", lavaBlazes); + increaseSeaCreatures(); + } else if (message.contains("A Lava Pigman arose from the depths")) { + lavaPigmen++; + lavaPigmenSession++; + ConfigHandler.writeIntConfig("fishing", "lavaPigman", lavaPigmen); + increaseSeaCreatures(); + } else if (message.contains("A Zombie Miner surfaces")) { + zombieMiners++; + zombieMinersSession++; + ConfigHandler.writeIntConfig("fishing", "zombieMiner", zombieMiners); + increaseSeaCreatures(); } } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 1878b47..812108b 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -680,6 +680,50 @@ public class LootDisplay { EnumChatFormatting.GOLD + nf.format(FishingTracker.phantomFishersSession) + "\n" + EnumChatFormatting.GOLD + nf.format(FishingTracker.grimReapersSession); break; + case "fishing_ch": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.BLUE + "Water Worms:\n" + + EnumChatFormatting.GREEN + "Poison Water Worms:\n" + + EnumChatFormatting.RED + "Flaming Worms:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Blazes:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Pigmen:\n" + + EnumChatFormatting.GOLD + "Zombie Miners:"; + countText = EnumChatFormatting.AQUA + nf.format(FishingTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(FishingTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.greatCatches) + "\n" + + EnumChatFormatting.BLUE + nf.format(FishingTracker.waterWorms) + "\n" + + EnumChatFormatting.GREEN + nf.format(FishingTracker.poisonedWaterWorms) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.flamingWorms) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaBlazes) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaPigmen) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.zombieMiners); + break; + case "fishing_ch_session": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.BLUE + "Water Worms:\n" + + EnumChatFormatting.GREEN + "Poison Water Worms:\n" + + EnumChatFormatting.RED + "Flaming Worms:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Blazes:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Pigmen:\n" + + EnumChatFormatting.GOLD + "Zombie Miners:"; + countText = EnumChatFormatting.AQUA + nf.format(FishingTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(FishingTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(FishingTracker.waterWormsSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(FishingTracker.poisonedWaterWormsSession) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.flamingWormsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaBlazesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaPigmenSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.zombieMinersSession); + break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index c7af0da..6edffa9 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -7,6 +7,7 @@ import me.Danker.gui.buttons.FeatureButton; import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -274,8 +275,7 @@ public class DankerGui extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); String pageText = "Page: " + page + "/" + (int) Math.ceil(foundButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(pageText, width, 10, 1D); for (GuiButton button : this.buttonList) { if (button instanceof FeatureButton && button.isMouseOver()) { diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 06239b1..4da92c6 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -4,6 +4,7 @@ import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -26,7 +27,7 @@ public class DisplayGui extends GuiScreen { private GuiButton fishingWinter; private GuiButton fishingFestival; private GuiButton fishingSpooky; - private GuiButton mythological; + private GuiButton fishingCH; private GuiButton catacombsF1; private GuiButton catacombsF2; private GuiButton catacombsF3; @@ -35,6 +36,7 @@ public class DisplayGui extends GuiScreen { private GuiButton catacombsF6; private GuiButton catacombsF7; private GuiButton catacombsMM; + private GuiButton mythological; private GuiButton ghost; @Override @@ -54,16 +56,15 @@ public class DisplayGui extends GuiScreen { showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off"); auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); - zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.3), 100, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.3), 100, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 100, 20, "Wolf"); - enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.3), 100, 20, "Enderman"); - fishing = new GuiButton(0, width / 2 - 230, (int) (height * 0.4), 100, 20, "Fishing"); - fishingWinter = new GuiButton(0, width / 2 - 110, (int) (height * 0.4), 100, 20, "Fishing Winter"); - fishingFestival = new GuiButton(0, width / 2 + 10, (int) (height * 0.4), 100, 20, "Fishing Festival"); - fishingSpooky = new GuiButton(0, width / 2 + 130, (int) (height * 0.4), 100, 20, "Fishing Spooky"); - mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), 95, 20, "Mythological"); - ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 95, 20, "Ghost"); + zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.35), 100, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.35), 100, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.35), 100, 20, "Wolf"); + enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.35), 100, 20, "Enderman"); + fishing = new GuiButton(0, width / 2 - 270, (int) (height * 0.5), 100, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 160, (int) (height * 0.5), 100, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 - 50, (int) (height * 0.5), 100, 20, "Fishing Festival"); + fishingSpooky = new GuiButton(0, width / 2 + 60, (int) (height * 0.5), 100, 20, "Fishing Spooky"); + fishingCH = new GuiButton(0, width / 2 + 170, (int) (height * 0.5), 100, 20, "CH Fishing"); catacombsF1 = new GuiButton(0, width / 2 - 235, (int) (height * 0.65), 50, 20, "F1"); catacombsF2 = new GuiButton(0, width / 2 - 175, (int) (height * 0.65), 50, 20, "F2"); catacombsF3 = new GuiButton(0, width / 2 - 115, (int) (height * 0.65), 50, 20, "F3"); @@ -72,6 +73,8 @@ public class DisplayGui extends GuiScreen { catacombsF6 = new GuiButton(0, width / 2 + 65, (int) (height * 0.65), 50, 20, "F6"); catacombsF7 = new GuiButton(0, width / 2 + 125, (int) (height * 0.65), 50, 20, "F7"); catacombsMM = new GuiButton(0, width / 2 + 185, (int) (height * 0.65), 50, 20, "MM"); + mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 95, 20, "Mythological"); + ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.8), 95, 20, "Ghost"); this.buttonList.add(showSession); this.buttonList.add(off); @@ -84,7 +87,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(fishingWinter); this.buttonList.add(fishingFestival); this.buttonList.add(fishingSpooky); - this.buttonList.add(mythological); + this.buttonList.add(fishingCH); this.buttonList.add(catacombsF1); this.buttonList.add(catacombsF2); this.buttonList.add(catacombsF3); @@ -93,6 +96,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(catacombsF6); this.buttonList.add(catacombsF7); this.buttonList.add(catacombsMM); + this.buttonList.add(mythological); this.buttonList.add(ghost); this.buttonList.add(goBack); } @@ -100,20 +104,13 @@ public class DisplayGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - Minecraft mc = Minecraft.getMinecraft(); - - String displayText; - if (LootDisplay.auto) { - displayText = "Current Display: auto"; - } else { - displayText = "Current Display: " + LootDisplay.display; - } - int displayWidth = mc.fontRendererObj.getStringWidth(displayText); - new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); - - String catacombsTitleText = "Catacombs Dungeon"; - int catacombsTitleWidth = mc.fontRendererObj.getStringWidth(catacombsTitleText); - new TextRenderer(mc, catacombsTitleText, width / 2 - catacombsTitleWidth / 2, (int) (height * 0.6), 1D); + + String displayText = LootDisplay.auto ? "Current Display: auto" : "Current Display: " + LootDisplay.display; + RenderUtils.drawCenteredText(displayText, width, 10, 1D); + RenderUtils.drawCenteredText("Slayer", width, (int) (height * 0.3), 1D); + RenderUtils.drawCenteredText("Fishing", width, (int) (height * 0.45), 1D); + RenderUtils.drawCenteredText("Catacombs Dungeon", width, (int) (height * 0.6), 1D); + RenderUtils.drawCenteredText("Misc", width, (int) (height * 0.75), 1D); super.drawScreen(mouseX, mouseY, partialTicks); } @@ -146,6 +143,8 @@ public class DisplayGui extends GuiScreen { setDisplay("fishing_festival"); } else if (button == fishingSpooky) { setDisplay("fishing_spooky"); + } else if (button == fishingCH) { + setDisplay("fishing_ch"); } else if (button == mythological) { setDisplay("mythological"); } else if (button == catacombsF1) { diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index c203b8a..a5674f8 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -5,6 +5,7 @@ import me.Danker.commands.ToggleCommand; import me.Danker.features.BlockWrongSlayer; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -97,8 +98,7 @@ public class OnlySlayerGui extends GuiScreen { } else { displayText = "Only Allow Slayer: " + BlockWrongSlayer.onlySlayerName + " " + BlockWrongSlayer.onlySlayerNumber; } - int displayWidth = mc.fontRendererObj.getStringWidth(displayText); - new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(displayText, width, 10, 1D); super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java index 290310f..84cc2e3 100644 --- a/src/main/java/me/Danker/gui/SkillTrackerGui.java +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -4,6 +4,7 @@ import me.Danker.DankersSkyblockMod; import me.Danker.features.SkillTracker; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -50,6 +51,7 @@ public class SkillTrackerGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); + String stateText = ""; if (SkillTracker.skillStopwatch.isStarted() && !SkillTracker.skillStopwatch.isSuspended()) { stateText = "Timer: Running"; @@ -59,8 +61,8 @@ public class SkillTrackerGui extends GuiScreen { if (!SkillTracker.showSkillTracker) { stateText += " (Hidden)"; } - int stateTextWidth = mc.fontRendererObj.getStringWidth(stateText); - new TextRenderer(mc, stateText, width / 2 - stateTextWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(stateText, width, 10, 1D); + super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/me/Danker/gui/WarningGui.java b/src/main/java/me/Danker/gui/WarningGui.java index db0c21b..bb37b83 100644 --- a/src/main/java/me/Danker/gui/WarningGui.java +++ b/src/main/java/me/Danker/gui/WarningGui.java @@ -1,10 +1,12 @@ package me.Danker.gui; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; public class WarningGui extends GuiScreen { private GuiButton close; @@ -34,15 +36,11 @@ public class WarningGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - String text0 = "ยงcWARNING!ยง0"; - int text0Width = mc.fontRendererObj.getStringWidth(text0); - new TextRenderer(mc, text0, (int)(width * 0.45) - text0Width / 2, (int) (height * 0.1), 2 ); - String text1 = "You are using SpiderFrog's Old Animations mod."; - int text1Width = mc.fontRendererObj.getStringWidth(text1); - new TextRenderer(mc, text1, width / 2 - text1Width / 2, (int) (height * 0.3), 1D ); - String text2 = "This mod breaks Danker's Skyblock Mod."; - int text2Width = mc.fontRendererObj.getStringWidth(text2); - new TextRenderer(mc, text2, width / 2 - text2Width / 2, (int) (height * 0.4), 1D); + + RenderUtils.drawCenteredText(EnumChatFormatting.RED + "WARNING!", (int) (width * 0.9), (int) (height * 0.1), 2D); + RenderUtils.drawCenteredText("You are using SpiderFrog's Old Animations mod.", width, (int) (height * 0.3), 1D); + RenderUtils.drawCenteredText("This mod breaks Danker's Skyblock Mod.", width, (int) (height * 0.4), 1D); + super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java index 06dfd91..034ad79 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java @@ -2,6 +2,7 @@ package me.Danker.gui.alerts; import me.Danker.features.Alerts; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -55,6 +56,7 @@ public class AlertActionGui extends GuiScreen { Alerts.Alert alert = Alerts.alerts.get(id); + RenderUtils.drawCenteredText(alert.alert, width, 10, 1D); String alertText = alert.alert; int textWidth = mc.fontRendererObj.getStringWidth(alertText); new TextRenderer(mc, alertText, width / 2 - textWidth / 2, 10, 1D); diff --git a/src/main/java/me/Danker/gui/alerts/AlertsGui.java b/src/main/java/me/Danker/gui/alerts/AlertsGui.java index 3ccd869..8eaedca 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertsGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertsGui.java @@ -6,6 +6,7 @@ import me.Danker.gui.DankerGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -78,8 +79,7 @@ public class AlertsGui extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(pageText, width, 10, 1D); } @Override diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java index f792892..30447a0 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java @@ -3,6 +3,7 @@ package me.Danker.gui.crystalhollowwaypoints; import me.Danker.DankersSkyblockMod; import me.Danker.features.CrystalHollowWaypoints; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -63,9 +64,7 @@ public class CrystalHollowWaypointActionGui extends GuiScreen { CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); - String waypointText = waypoint.location + " @ " + waypoint.getPos(); - int pageWidth = mc.fontRendererObj.getStringWidth(waypointText); - new TextRenderer(mc, waypointText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(waypoint.location + " @ " + waypoint.getPos(), width, 10, 1D); } @Override diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java index a3d0452..2331ec0 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java @@ -7,6 +7,7 @@ import me.Danker.gui.DankerGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -94,8 +95,7 @@ public class CrystalHollowWaypointsGui extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(pageText, width, 10, 1D); } @Override diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 112d86d..e5ed372 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -417,6 +417,13 @@ public class ConfigHandler { FishingTracker.werewolfs = initInt("fishing", "werewolf", 0); FishingTracker.phantomFishers = initInt("fishing", "phantomFisher", 0); FishingTracker.grimReapers = initInt("fishing", "grimReaper", 0); + // CH Fishing + FishingTracker.waterWorms = initInt("fishing", "waterWorm", 0); + FishingTracker.poisonedWaterWorms = initInt("fishing", "poisonedWaterWorm", 0); + FishingTracker.flamingWorms = initInt("fishing", "flamingWorm", 0); + FishingTracker.lavaBlazes = initInt("fishing", "lavaBlaze", 0); + FishingTracker.lavaPigmen = initInt("fishing", "lavaPigman", 0); + FishingTracker.zombieMiners = initInt("fishing", "zombieMiner", 0); // Mythological MythologicalTracker.mythCoins = initDouble("mythological", "coins", 0); diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index f117969..50b9786 100644 --- a/src/main/java/me/Danker/utils/RenderUtils.java +++ b/src/main/java/me/Danker/utils/RenderUtils.java @@ -363,4 +363,10 @@ public class RenderUtils { GlStateManager.disableRescaleNormal(); } + public static void drawCenteredText(String text, int screenWidth, int height, double scale) { + Minecraft mc = Minecraft.getMinecraft(); + int textWidth = mc.fontRendererObj.getStringWidth(text); + new TextRenderer(mc, text, screenWidth / 2 - textWidth / 2, height, scale); + } + } -- cgit From 4a9c72be2c81059569f6cf75e854b9cdefc2891a Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 4 Mar 2022 20:26:29 -0500 Subject: Add custom colours to titles --- src/main/java/me/Danker/DankersSkyblockMod.java | 1 - .../me/Danker/commands/CustomMusicCommand.java | 3 --- .../java/me/Danker/commands/InventoryCommand.java | 1 - .../java/me/Danker/features/AbilityCooldowns.java | 1 - .../java/me/Danker/features/ColouredNames.java | 31 ++++++++++++++++++++++ src/main/java/me/Danker/features/DungeonScore.java | 2 -- src/main/java/me/Danker/gui/CustomMusicGui.java | 1 - src/main/java/me/Danker/gui/DankerGui.java | 2 -- src/main/java/me/Danker/gui/DisplayGui.java | 2 -- src/main/java/me/Danker/gui/ExperimentsGui.java | 1 - src/main/java/me/Danker/gui/OnlySlayerGui.java | 4 --- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 1 - src/main/java/me/Danker/gui/SkillTrackerGui.java | 2 -- src/main/java/me/Danker/gui/WarningGui.java | 1 - .../java/me/Danker/gui/alerts/AlertAddGui.java | 3 --- src/main/java/me/Danker/gui/alerts/AlertsGui.java | 1 - .../CrystalHollowWaypointActionGui.java | 1 - .../CrystalHollowWaypointsGui.java | 2 -- .../java/me/Danker/handlers/ConfigHandler.java | 6 +++-- src/main/java/me/Danker/utils/Utils.java | 1 - 20 files changed, 35 insertions(+), 32 deletions(-) (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 0d7e577..ce39152 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -9,7 +9,6 @@ import me.Danker.features.*; import me.Danker.features.loot.*; import me.Danker.features.puzzlesolvers.*; import me.Danker.gui.*; -import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.PacketHandler; import me.Danker.utils.RenderUtils; diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java index d21d08e..283b748 100644 --- a/src/main/java/me/Danker/commands/CustomMusicCommand.java +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -10,9 +10,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; -import javax.sound.sampled.LineUnavailableException; -import javax.sound.sampled.UnsupportedAudioFileException; -import java.io.IOException; import java.util.List; public class CustomMusicCommand extends CommandBase { diff --git a/src/main/java/me/Danker/commands/InventoryCommand.java b/src/main/java/me/Danker/commands/InventoryCommand.java index d4b35ae..66a5725 100644 --- a/src/main/java/me/Danker/commands/InventoryCommand.java +++ b/src/main/java/me/Danker/commands/InventoryCommand.java @@ -12,7 +12,6 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryBasic; import net.minecraft.item.ItemStack; diff --git a/src/main/java/me/Danker/features/AbilityCooldowns.java b/src/main/java/me/Danker/features/AbilityCooldowns.java index 397857a..e98660e 100644 --- a/src/main/java/me/Danker/features/AbilityCooldowns.java +++ b/src/main/java/me/Danker/features/AbilityCooldowns.java @@ -12,7 +12,6 @@ import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; diff --git a/src/main/java/me/Danker/features/ColouredNames.java b/src/main/java/me/Danker/features/ColouredNames.java index f7f4d7a..aad1ab1 100644 --- a/src/main/java/me/Danker/features/ColouredNames.java +++ b/src/main/java/me/Danker/features/ColouredNames.java @@ -2,10 +2,12 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.PacketReadEvent; import me.Danker.utils.Utils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.network.play.server.S45PacketTitle; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -16,7 +18,9 @@ import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.ReflectionHelper; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -30,6 +34,8 @@ public class ColouredNames { public static Map nametags = new HashMap<>(); public static final EnumChatFormatting[] RAINBOW_COLOURS = new EnumChatFormatting[]{EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.GREEN, EnumChatFormatting.AQUA, EnumChatFormatting.BLUE, EnumChatFormatting.DARK_PURPLE}; + static Field messageField = ReflectionHelper.findField(S45PacketTitle.class, "message", "field_179810_b", "b"); + @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { if (!ToggleCommand.customColouredNames || !Utils.inSkyblock || event.type != 0) return; @@ -90,6 +96,31 @@ public class ColouredNames { } } + @SubscribeEvent + public void onPacketRead(PacketReadEvent event) { + if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return; + + if (event.packet instanceof S45PacketTitle) { + S45PacketTitle packet = (S45PacketTitle) event.packet; + + if (packet.getMessage() == null) return; + + String message = packet.getMessage().getUnformattedText(); + for (String user : users) { + if (message.contains(user)) { + try { + messageField.setAccessible(true); + messageField.set(packet, replaceChat(packet.getMessage(), user)); + event.packet = packet; + } catch (IllegalAccessException ex) { + ex.printStackTrace(); + } + break; + } + } + } + } + @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { nametags.clear(); diff --git a/src/main/java/me/Danker/features/DungeonScore.java b/src/main/java/me/Danker/features/DungeonScore.java index 2b6b287..706ce62 100644 --- a/src/main/java/me/Danker/features/DungeonScore.java +++ b/src/main/java/me/Danker/features/DungeonScore.java @@ -5,12 +5,10 @@ import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import me.Danker.events.RenderOverlayEvent; -import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; diff --git a/src/main/java/me/Danker/gui/CustomMusicGui.java b/src/main/java/me/Danker/gui/CustomMusicGui.java index 6695b9a..4d5dcc9 100644 --- a/src/main/java/me/Danker/gui/CustomMusicGui.java +++ b/src/main/java/me/Danker/gui/CustomMusicGui.java @@ -1,6 +1,5 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.features.CustomMusic; import me.Danker.handlers.ConfigHandler; diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 6edffa9..d5e9ee8 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -1,12 +1,10 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.gui.alerts.AlertsGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 4da92c6..17726f8 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -1,9 +1,7 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java index 3cc4929..53eb118 100644 --- a/src/main/java/me/Danker/gui/ExperimentsGui.java +++ b/src/main/java/me/Danker/gui/ExperimentsGui.java @@ -1,6 +1,5 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index a5674f8..2a6d844 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -1,12 +1,8 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; -import me.Danker.commands.ToggleCommand; import me.Danker.features.BlockWrongSlayer; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; -import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 3356ead..0cfa72b 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -1,6 +1,5 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java index 84cc2e3..e77f785 100644 --- a/src/main/java/me/Danker/gui/SkillTrackerGui.java +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -1,9 +1,7 @@ package me.Danker.gui; -import me.Danker.DankersSkyblockMod; import me.Danker.features.SkillTracker; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; diff --git a/src/main/java/me/Danker/gui/WarningGui.java b/src/main/java/me/Danker/gui/WarningGui.java index bb37b83..901b59e 100644 --- a/src/main/java/me/Danker/gui/WarningGui.java +++ b/src/main/java/me/Danker/gui/WarningGui.java @@ -1,6 +1,5 @@ package me.Danker.gui; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; diff --git a/src/main/java/me/Danker/gui/alerts/AlertAddGui.java b/src/main/java/me/Danker/gui/alerts/AlertAddGui.java index 9014ea1..efc099c 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertAddGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertAddGui.java @@ -1,7 +1,5 @@ package me.Danker.gui.alerts; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import me.Danker.features.Alerts; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; @@ -11,7 +9,6 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.ScaledResolution; import net.minecraftforge.fml.client.config.GuiCheckBox; -import java.io.FileWriter; import java.io.IOException; public class AlertAddGui extends GuiScreen { diff --git a/src/main/java/me/Danker/gui/alerts/AlertsGui.java b/src/main/java/me/Danker/gui/alerts/AlertsGui.java index 8eaedca..d73d56a 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertsGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertsGui.java @@ -5,7 +5,6 @@ import me.Danker.features.Alerts; import me.Danker.gui.DankerGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java index 30447a0..8d6fa85 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java @@ -2,7 +2,6 @@ package me.Danker.gui.crystalhollowwaypoints; import me.Danker.DankersSkyblockMod; import me.Danker.features.CrystalHollowWaypoints; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java index 2331ec0..fc0f108 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java @@ -1,12 +1,10 @@ package me.Danker.gui.crystalhollowwaypoints; -import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.features.CrystalHollowWaypoints; import me.Danker.gui.DankerGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index e5ed372..3839766 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -2,7 +2,6 @@ package me.Danker.handlers; import com.google.gson.Gson; import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -16,7 +15,10 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; -import java.io.*; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 682c5af..8c48c54 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -9,7 +9,6 @@ import me.Danker.handlers.ScoreboardHandler; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.player.EntityPlayer; -- cgit From f214832fb6f315d59d876267f71e9e9f0a6082fd Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 20 Apr 2022 22:52:26 -0400 Subject: Add blaze slayer support + tracker --- README.md | 8 +- src/main/java/me/Danker/DankersSkyblockMod.java | 1 + .../me/Danker/commands/BlockSlayerCommand.java | 10 +- .../java/me/Danker/commands/DisplayCommand.java | 13 +- src/main/java/me/Danker/commands/LootCommand.java | 89 +++++++++- .../java/me/Danker/commands/ResetLootCommand.java | 39 ++++- .../me/Danker/commands/SkyblockPlayersCommand.java | 19 +-- .../java/me/Danker/commands/SlayerCommand.java | 10 +- .../java/me/Danker/commands/WeightCommand.java | 2 + src/main/java/me/Danker/features/AutoDisplay.java | 3 + .../java/me/Danker/features/loot/BlazeTracker.java | 184 +++++++++++++++++++++ .../java/me/Danker/features/loot/LootDisplay.java | 122 ++++++++++++++ .../java/me/Danker/features/loot/LootTracker.java | 6 +- src/main/java/me/Danker/gui/DisplayGui.java | 13 +- src/main/java/me/Danker/gui/OnlySlayerGui.java | 14 +- .../java/me/Danker/handlers/ConfigHandler.java | 27 ++- 16 files changed, 519 insertions(+), 41 deletions(-) create mode 100644 src/main/java/me/Danker/features/loot/BlazeTracker.java (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/README.md b/README.md index 4a77ae4..2a740c7 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/festival/spooky/ch/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/ch/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. -- /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. +- /loot [winter/festival/spooky/ch/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/ch/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. - /slayer [player] - Uses API to get slayer xp of a person. If no name is provided, it checks yours. @@ -88,7 +88,7 @@ Discord Server: https://discord.gg/QsEkNQS - /weight [player] [lily/farming] - Uses API to get weight of a person. If no name is provided, it checks yours. Adding lily uses lily's weight. Adding farming uses Kaeso's farming weight. - /importfishing - Imports your fishing stats from your latest profile to your fishing tracker using the API. - /sbplayers - Uses API to find how many players are on each Skyblock island. -- /onlyslayer <1/2/3/4/5> +- /onlyslayer <1/2/3/4/5> - /skilltracker - Text display for skill xp/hour. - /reparty - Disbands and reparties all members in the party - /fairysouls - Check the fairysouls of a player diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 07ba904..fb98068 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -166,6 +166,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new LootDisplay()); MinecraftForge.EVENT_BUS.register(new LootTracker()); + MinecraftForge.EVENT_BUS.register(new BlazeTracker()); MinecraftForge.EVENT_BUS.register(new CatacombsTracker()); MinecraftForge.EVENT_BUS.register(new EndermanTracker()); MinecraftForge.EVENT_BUS.register(new FishingTracker()); diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java index 9f51be6..37047c9 100644 --- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java +++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java @@ -21,7 +21,7 @@ public class BlockSlayerCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <1/2/3/4/5>"; + return "/" + getCommandName() + " <1/2/3/4/5>"; } public static String usage(ICommandSender arg0) { @@ -36,7 +36,7 @@ public class BlockSlayerCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "enderman"); + return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "enderman", "blaze"); } else if (args.length == 2) { return getListOfStringsMatchingLastWord(args, "1", "2", "3", "4", "5"); } @@ -62,6 +62,12 @@ public class BlockSlayerCommand extends CommandBase { case "wolf": BlockWrongSlayer.onlySlayerName = "Sven Packmaster"; break; + case "enderman": + BlockWrongSlayer.onlySlayerName = "Voidgloom Seraph"; + break; + case "blaze": + BlockWrongSlayer.onlySlayerName = "Inferno Demonlord"; + break; case "off": BlockWrongSlayer.onlySlayerName = ""; BlockWrongSlayer.onlySlayerNumber = ""; diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 3db6853..174258d 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/session/f(1-7)/mm]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -36,7 +36,7 @@ public class DisplayCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); + return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { @@ -89,6 +89,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "enderman"; } break; + case "blaze": + if (showSession) { + LootDisplay.display = "blaze_session"; + } else { + LootDisplay.display = "blaze"; + } + break; case "fishing": if (arg1.length > 1) { switch (arg1[1].toLowerCase()) { @@ -213,7 +220,7 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "catacombs_master"; } default: - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /display catacombs ")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /display catacombs ")); return; } break; diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 5edc5f4..5d91573 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/f(1-7)/mm/session]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -39,7 +39,7 @@ public class LootCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "fishing", "catacombs", "mythological"); + return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { @@ -64,9 +64,8 @@ public class LootCommand extends CommandBase { String bossesBetween; String drop20; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); - boolean showSession = false; - if (arg1[arg1.length - 1].equalsIgnoreCase("session")) showSession = true; + boolean showSession = arg1[arg1.length - 1].equalsIgnoreCase("session"); switch (arg1[0].toLowerCase()) { case "wolf": @@ -363,6 +362,88 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.BOLD + " -------------------")); break; + case "blaze": + if (showSession) { + if (BlazeTracker.timeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(BlazeTracker.timeSession, timeNow); + } + if (BlazeTracker.bossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(BlazeTracker.bossesSession); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " Blaze Loot Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Demonlords Killed: " + nf.format(BlazeTracker.demonlordsSession) + "\n" + + EnumChatFormatting.GRAY + " Derelict Ashes: " + nf.format(BlazeTracker.derelictAshesSession) + "\n" + + EnumChatFormatting.RED + " Lavatear Runes: " + nf.format(BlazeTracker.lavatearRunesSession) + "\n" + + EnumChatFormatting.AQUA + " Splash Potions: " + nf.format(BlazeTracker.splashPotionsSession) + "\n" + + EnumChatFormatting.DARK_RED + " Magma Arrows: " + nf.format(BlazeTracker.magmaArrowsSession) + "\n" + + EnumChatFormatting.DARK_AQUA + " Mana Disintegrators: " + nf.format(BlazeTracker.manaDisintegratorsSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Scorched Books: " + nf.format(BlazeTracker.scorchedBooksSession) + "\n" + + EnumChatFormatting.WHITE + " Kelvin Inverters: " + nf.format(BlazeTracker.kelvinInvertersSession) + "\n" + + EnumChatFormatting.BLUE + " Blaze Rod Distillates: " + nf.format(BlazeTracker.blazeRodDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + " Glowstone Distillates: " + nf.format(BlazeTracker.glowstoneDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + " Magma Cream Distillates: " + nf.format(BlazeTracker.magmaCreamDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + " Nether Wart Distillates: " + nf.format(BlazeTracker.netherWartDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + " Gabagool Distillates: " + nf.format(BlazeTracker.gabagoolDistillatesSession) + "\n" + + EnumChatFormatting.RED + " Scorched Power Crystals: " + nf.format(BlazeTracker.scorchedPowerCrystalsSession) + "\n" + + EnumChatFormatting.RED + " Fire Aspect Books: " + nf.format(BlazeTracker.fireAspectBooksSession) + "\n" + + EnumChatFormatting.GOLD + " Fiery Burst Runes: " + nf.format(BlazeTracker.fieryBurstRunesSession) + "\n" + + EnumChatFormatting.WHITE + " Opal Gems: " + nf.format(BlazeTracker.opalGemsSession) + "\n" + + EnumChatFormatting.RED + " Archfiend Dice: " + nf.format(BlazeTracker.archfiendDiceSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Duplex Books: " + nf.format(BlazeTracker.duplexBooksSession) + "\n" + + EnumChatFormatting.GOLD + " High Class Archfiend Dice: " + nf.format(BlazeTracker.highClassArchfiendDiceSession) + "\n" + + EnumChatFormatting.GOLD + " Engineering Plans: " + nf.format(BlazeTracker.engineeringPlansSession) + "\n" + + EnumChatFormatting.GOLD + " Subzero Inverters: " + nf.format(BlazeTracker.subzeroInvertersSession) + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " -------------------")); + return; + } + + if (BlazeTracker.time == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(BlazeTracker.time, timeNow); + } + if (BlazeTracker.bosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(BlazeTracker.bosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " Blaze Loot Summary:\n" + + EnumChatFormatting.GOLD + " Demonlords Killed: " + nf.format(BlazeTracker.demonlords) + "\n" + + EnumChatFormatting.GRAY + " Derelict Ashes: " + nf.format(BlazeTracker.derelictAshes) + "\n" + + EnumChatFormatting.RED + " Lavatear Runes: " + nf.format(BlazeTracker.lavatearRunes) + "\n" + + EnumChatFormatting.AQUA + " Splash Potions: " + nf.format(BlazeTracker.splashPotions) + "\n" + + EnumChatFormatting.DARK_RED + " Magma Arrows: " + nf.format(BlazeTracker.magmaArrows) + "\n" + + EnumChatFormatting.DARK_AQUA + " Mana Disintegrators: " + nf.format(BlazeTracker.manaDisintegrators) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Scorched Books: " + nf.format(BlazeTracker.scorchedBooks) + "\n" + + EnumChatFormatting.WHITE + " Kelvin Inverters: " + nf.format(BlazeTracker.kelvinInverters) + "\n" + + EnumChatFormatting.BLUE + " Blaze Rod Distillates: " + nf.format(BlazeTracker.blazeRodDistillates) + "\n" + + EnumChatFormatting.BLUE + " Glowstone Distillates: " + nf.format(BlazeTracker.glowstoneDistillates) + "\n" + + EnumChatFormatting.BLUE + " Magma Cream Distillates: " + nf.format(BlazeTracker.magmaCreamDistillates) + "\n" + + EnumChatFormatting.BLUE + " Nether Wart Distillates: " + nf.format(BlazeTracker.netherWartDistillates) + "\n" + + EnumChatFormatting.BLUE + " Gabagool Distillates: " + nf.format(BlazeTracker.gabagoolDistillates) + "\n" + + EnumChatFormatting.RED + " Scorched Power Crystals: " + nf.format(BlazeTracker.scorchedPowerCrystals) + "\n" + + EnumChatFormatting.RED + " Fire Aspect Books: " + nf.format(BlazeTracker.fireAspectBooks) + "\n" + + EnumChatFormatting.GOLD + " Fiery Burst Runes: " + nf.format(BlazeTracker.fieryBurstRunes) + "\n" + + EnumChatFormatting.WHITE + " Opal Gems: " + nf.format(BlazeTracker.opalGems) + "\n" + + EnumChatFormatting.RED + " Archfiend Dice: " + nf.format(BlazeTracker.archfiendDice) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Duplex Books: " + nf.format(BlazeTracker.duplexBooks) + "\n" + + EnumChatFormatting.GOLD + " High Class Archfiend Dice: " + nf.format(BlazeTracker.highClassArchfiendDice) + "\n" + + EnumChatFormatting.GOLD + " Engineering Plans: " + nf.format(BlazeTracker.engineeringPlans) + "\n" + + EnumChatFormatting.GOLD + " Subzero Inverters: " + nf.format(BlazeTracker.subzeroInverters) + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " -------------------")); + break; case "fishing": if (arg1.length > 1) { if (arg1[1].equalsIgnoreCase("winter")) { diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index f1d2828..d3294b2 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -25,7 +25,7 @@ public class ResetLootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + ""; + return "/" + getCommandName() + ""; } public static String usage(ICommandSender arg0) { @@ -44,7 +44,7 @@ public class ResetLootCommand extends CommandBase { if (confirmReset) { return getListOfStringsMatchingLastWord(args, "confirm", "cancel"); } else { - return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "enderman", "fishing", "mythological", "catacombs"); + return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "enderman", "blaze", "fishing", "mythological", "catacombs"); } } @@ -53,7 +53,7 @@ public class ResetLootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /resetloot ")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /resetloot ")); return; } @@ -75,6 +75,9 @@ public class ResetLootCommand extends CommandBase { case "enderman": resetEnderman(); break; + case "blaze": + resetBlaze(); + break; case "fishing": resetFishing(); break; @@ -102,6 +105,7 @@ public class ResetLootCommand extends CommandBase { case "spider": case "wolf": case "enderman": + case "blaze": case "fishing": case "mythological": case "catacombs": @@ -201,6 +205,35 @@ public class ResetLootCommand extends CommandBase { ConfigHandler.deleteCategory("enderman"); ConfigHandler.reloadConfig(); } + + static void resetBlaze() { + BlazeTracker.demonlordsSession = 0; + BlazeTracker.derelictAshesSession = 0; + BlazeTracker.lavatearRunesSession = 0; + BlazeTracker.splashPotionsSession = 0; + BlazeTracker.magmaArrowsSession = 0; + BlazeTracker.manaDisintegratorsSession = 0; + BlazeTracker.scorchedBooksSession = 0; + BlazeTracker.kelvinInvertersSession = 0; + BlazeTracker.blazeRodDistillatesSession = 0; + BlazeTracker.glowstoneDistillatesSession = 0; + BlazeTracker.magmaCreamDistillatesSession = 0; + BlazeTracker.netherWartDistillatesSession = 0; + BlazeTracker.gabagoolDistillatesSession = 0; + BlazeTracker.scorchedPowerCrystalsSession = 0; + BlazeTracker.fireAspectBooksSession = 0; + BlazeTracker.fieryBurstRunesSession = 0; + BlazeTracker.opalGemsSession = 0; + BlazeTracker.archfiendDiceSession = 0; + BlazeTracker.duplexBooksSession = 0; + BlazeTracker.highClassArchfiendDiceSession = 0; + BlazeTracker.engineeringPlansSession = 0; + BlazeTracker.subzeroInvertersSession = 0; + BlazeTracker.timeSession = 0; + BlazeTracker.bossesSession = 0; + ConfigHandler.deleteCategory("blaze"); + ConfigHandler.reloadConfig(); + } static void resetFishing() { FishingTracker.seaCreaturesSession = 0; diff --git a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java index 0923b57..37e89c5 100644 --- a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -70,15 +70,14 @@ public class SkyblockPlayersCommand extends CommandBase { int skyblockTotalPlayers = 0; // players int privateIsland = 0; // dynamic int hub = 0; // hub - int barn = 0; // farming_1 - int mushroomDesert = 0; // farming_2 + int farmingIslands = 0; // farming_1 int park = 0; // foraging_1 int goldMine = 0; // mining_1 int deepCaverns = 0; // mining_2 int dwarvenMines = 0; // mining_3 int crystalHollows = 0; // crystal_hollows int spidersDen = 0; // combat_1 - int blazingFortress = 0; // combat_2 + int crimsonIsle = 0; // crimson_isle int end = 0; // combat_3 int dungeonsHub = 0; // dungeon_hub int dungeons = 0; // dungeon @@ -94,10 +93,7 @@ public class SkyblockPlayersCommand extends CommandBase { hub = skyblockPlayers.get("hub").getAsInt(); } if (skyblockPlayers.has("farming_1")) { - barn = skyblockPlayers.get("farming_1").getAsInt(); - } - if (skyblockPlayers.has("farming_2")) { - mushroomDesert = skyblockPlayers.get("farming_2").getAsInt(); + farmingIslands = skyblockPlayers.get("farming_1").getAsInt(); } if (skyblockPlayers.has("foraging_1")) { park = skyblockPlayers.get("foraging_1").getAsInt(); @@ -117,8 +113,8 @@ public class SkyblockPlayersCommand extends CommandBase { if (skyblockPlayers.has("combat_1")) { spidersDen = skyblockPlayers.get("combat_1").getAsInt(); } - if (skyblockPlayers.has("combat_2")) { - blazingFortress = skyblockPlayers.get("combat_2").getAsInt(); + if (skyblockPlayers.has("crimson_isle")) { + crimsonIsle = skyblockPlayers.get("crimson_isle").getAsInt(); } if (skyblockPlayers.has("combat_3")) { end = skyblockPlayers.get("combat_3").getAsInt(); @@ -143,15 +139,14 @@ public class SkyblockPlayersCommand extends CommandBase { DankersSkyblockMod.TYPE_COLOUR + " Skyblock: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(skyblockTotalPlayers) + " / " + Utils.getPercentage(skyblockTotalPlayers, totalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Private Island: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(privateIsland) + " / " + Utils.getPercentage(privateIsland, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Hub: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(hub) + " / " + Utils.getPercentage(hub, skyblockTotalPlayers) + "%\n" + - DankersSkyblockMod.TYPE_COLOUR + " Barn: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(barn) + " / " + Utils.getPercentage(barn, skyblockTotalPlayers) + "%\n" + - DankersSkyblockMod.TYPE_COLOUR + " Mushroom Desert: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(mushroomDesert) + " / " + Utils.getPercentage(mushroomDesert, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Farming Islands: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(farmingIslands) + " / " + Utils.getPercentage(farmingIslands, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Park: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(park) + " / " + Utils.getPercentage(park, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Gold Mine: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(goldMine) + " / " + Utils.getPercentage(goldMine, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Deep Caverns: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(deepCaverns) + " / " + Utils.getPercentage(deepCaverns, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Dwarven Mines: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(dwarvenMines) + " / " + Utils.getPercentage(dwarvenMines, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Crystal Hollows: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(crystalHollows) + " / " + Utils.getPercentage(crystalHollows, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Spider's Den: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(spidersDen) + " / " + Utils.getPercentage(spidersDen, skyblockTotalPlayers) + "%\n" + - DankersSkyblockMod.TYPE_COLOUR + " Blazing Fortress: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(blazingFortress) + " / " + Utils.getPercentage(blazingFortress, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Crimson Isle: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(crimsonIsle) + " / " + Utils.getPercentage(crimsonIsle, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " The End: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(end) + " / " + Utils.getPercentage(end, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Dungeons Hub: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(dungeonsHub) + " / " + Utils.getPercentage(dungeonsHub, skyblockTotalPlayers) + "%\n" + DankersSkyblockMod.TYPE_COLOUR + " Dungeons: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(dungeons) + " / " + Utils.getPercentage(dungeons, skyblockTotalPlayers) + "%\n" + diff --git a/src/main/java/me/Danker/commands/SlayerCommand.java b/src/main/java/me/Danker/commands/SlayerCommand.java index 5444754..8ad87ae 100644 --- a/src/main/java/me/Danker/commands/SlayerCommand.java +++ b/src/main/java/me/Danker/commands/SlayerCommand.java @@ -113,15 +113,21 @@ public class SlayerCommand extends CommandBase { if (slayersObject.get("enderman").getAsJsonObject().has("xp")) { endermanXP = slayersObject.get("enderman").getAsJsonObject().get("xp").getAsInt(); } + // Blaze + int blazeXP = 0; + if (slayersObject.get("blaze").getAsJsonObject().has("xp")) { + blazeXP = slayersObject.get("blaze").getAsJsonObject().get("xp").getAsInt(); + } NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + - EnumChatFormatting.AQUA + " " + username + "'s Total XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + nf.format(zombieXP + spiderXP + wolfXP + endermanXP) + "\n" + + EnumChatFormatting.AQUA + " " + username + "'s Total XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + nf.format(zombieXP + spiderXP + wolfXP + endermanXP + blazeXP) + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Zombie XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(zombieXP) + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Spider XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(spiderXP) + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Wolf XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(wolfXP) + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Enderman XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(endermanXP) + "\n" + - DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Blaze XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(blazeXP) + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/WeightCommand.java b/src/main/java/me/Danker/commands/WeightCommand.java index b00d881..ade909d 100644 --- a/src/main/java/me/Danker/commands/WeightCommand.java +++ b/src/main/java/me/Danker/commands/WeightCommand.java @@ -63,6 +63,8 @@ public class WeightCommand extends CommandBase { public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { return Utils.getMatchingPlayers(args[0]); + } else if (args.length == 2) { + return getListOfStringsMatchingLastWord(args, "lily", "farming"); } return null; } diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 5fc4489..63b66d5 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -42,6 +42,9 @@ public class AutoDisplay { } else if (sCleaned.contains("Voidgloom Seraph")) { LootDisplay.display = "enderman"; found = true; + } else if (sCleaned.contains("Inferno Demonlord")) { + LootDisplay.display = "blaze"; + found = true; } else if (sCleaned.contains("The Mist")){ LootDisplay.display = "ghost"; found = true; diff --git a/src/main/java/me/Danker/features/loot/BlazeTracker.java b/src/main/java/me/Danker/features/loot/BlazeTracker.java new file mode 100644 index 0000000..896f65f --- /dev/null +++ b/src/main/java/me/Danker/features/loot/BlazeTracker.java @@ -0,0 +1,184 @@ +package me.Danker.features.loot; + +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class BlazeTracker { + + public static int demonlords; + public static int derelictAshes; + public static int lavatearRunes; + public static int splashPotions; + public static int magmaArrows; + public static int manaDisintegrators; + public static int scorchedBooks; + public static int kelvinInverters; + public static int blazeRodDistillates; + public static int glowstoneDistillates; + public static int magmaCreamDistillates; + public static int netherWartDistillates; + public static int gabagoolDistillates; + public static int scorchedPowerCrystals; + public static int fireAspectBooks; + public static int fieryBurstRunes; + public static int opalGems; + public static int archfiendDice; + public static int duplexBooks; + public static int highClassArchfiendDice; + public static int engineeringPlans; + public static int subzeroInverters; + public static double time; + public static int bosses; + + public static int demonlordsSession = 0; + public static int derelictAshesSession = 0; + public static int lavatearRunesSession = 0; + public static int splashPotionsSession = 0; + public static int magmaArrowsSession = 0; + public static int manaDisintegratorsSession = 0; + public static int scorchedBooksSession = 0; + public static int kelvinInvertersSession = 0; + public static int blazeRodDistillatesSession = 0; + public static int glowstoneDistillatesSession = 0; + public static int magmaCreamDistillatesSession = 0; + public static int netherWartDistillatesSession = 0; + public static int gabagoolDistillatesSession = 0; + public static int scorchedPowerCrystalsSession = 0; + public static int fireAspectBooksSession = 0; + public static int fieryBurstRunesSession = 0; + public static int opalGemsSession = 0; + public static int archfiendDiceSession = 0; + public static int duplexBooksSession = 0; + public static int highClassArchfiendDiceSession = 0; + public static int engineeringPlansSession = 0; + public static int subzeroInvertersSession = 0; + public static double timeSession = 0; + public static int bossesSession = 0; + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (event.type == 2) return; + if (message.contains(":")) return; + + boolean rng = false; + + if (message.contains(" Blaze Slayer LVL ")) { + demonlords++; + demonlordsSession++; + if (bosses != -1) { + bosses++; + } + if (bossesSession != -1) { + bossesSession++; + } + ConfigHandler.writeIntConfig("blaze", "demonlords", demonlords); + ConfigHandler.writeIntConfig("blaze", "bossRNG", bosses); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Lavatears Rune I)")) { + lavatearRunes++; + lavatearRunesSession++; + ConfigHandler.writeIntConfig("blaze", "lavatearRunes", lavatearRunes); + } else if (message.contains("VERY RARE DROP! (Wisp's Ice-Flavored Water I Splash Potion)")) { + splashPotions++; + splashPotionsSession++; + ConfigHandler.writeIntConfig("blaze", "splashPotions", splashPotions); + } else if (message.contains("RARE DROP! (Bundle of Magma Arrows)")) { + magmaArrows++; + magmaArrowsSession++; + ConfigHandler.writeIntConfig("blaze", "magmaArrows", magmaArrows); + } else if (message.contains("VERY RARE DROP! (Mana Disintegrator)")) { + manaDisintegrators++; + manaDisintegratorsSession++; + ConfigHandler.writeIntConfig("blaze", "manaDisintegrators", manaDisintegrators); + } else if (message.contains("VERY RARE DROP! (Scorched Books)")) { + scorchedBooks++; + scorchedBooksSession++; + ConfigHandler.writeIntConfig("blaze", "scorchedBooks", scorchedBooks); + } else if (message.contains("VERY RARE DROP! (Kelvin Inverter)")) { + kelvinInverters++; + kelvinInvertersSession++; + ConfigHandler.writeIntConfig("blaze", "kelvinInverters", kelvinInverters); + } else if (message.contains("VERY RARE DROP! (Blaze Rod Distillate)")) { + blazeRodDistillates++; + blazeRodDistillatesSession++; + ConfigHandler.writeIntConfig("blaze", "blazeRodDistillates", blazeRodDistillates); + } else if (message.contains("VERY RARE DROP! (Glowstone Distillate)")) { + glowstoneDistillates++; + glowstoneDistillatesSession++; + ConfigHandler.writeIntConfig("blaze", "glowstoneDistillates", glowstoneDistillates); + } else if (message.contains("VERY RARE DROP! (Magma Cream Distillate)")) { + magmaCreamDistillates++; + magmaCreamDistillatesSession++; + ConfigHandler.writeIntConfig("blaze", "magmaCreamDistillates", magmaCreamDistillates); + } else if (message.contains("VERY RARE DROP! (Nether Wart Distillate)")) { + netherWartDistillates++; + netherWartDistillatesSession++; + ConfigHandler.writeIntConfig("blaze", "netherWartDistillates", netherWartDistillates); + } else if (message.contains("VERY RARE DROP! (Gabagool Distillate)")) { + gabagoolDistillates++; + gabagoolDistillatesSession++; + ConfigHandler.writeIntConfig("blaze", "gabagoolDistillates", gabagoolDistillates); + } else if (message.contains("VERY RARE DROP! (Scorched Power Crystal)")) { + scorchedPowerCrystals++; + scorchedPowerCrystalsSession++; + ConfigHandler.writeIntConfig("blaze", "scorchedPowerCrystals", scorchedPowerCrystals); + } else if (message.contains("VERY RARE DROP! (Fire Aspect III)")) { + fireAspectBooks++; + fireAspectBooksSession++; + ConfigHandler.writeIntConfig("blaze", "fireAspectBooks", fireAspectBooks); + } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Fiery Burst Rune I)")) { + rng = true; + fieryBurstRunes++; + fieryBurstRunesSession++; + ConfigHandler.writeIntConfig("blaze", "fieryBurstRunes", fieryBurstRunes); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "FIERY BURST RUNE!", 5); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Flawed Opal Gemstone)")) { + opalGems++; + opalGemsSession++; + ConfigHandler.writeIntConfig("blaze", "opalGems", opalGems); + } else if (message.contains("VERY RARE DROP! (Archfiend Dice)")) { + archfiendDice++; + archfiendDiceSession++; + ConfigHandler.writeIntConfig("blaze", "archfiendDice", archfiendDice); + } else if (message.contains("VERY RARE DROP! (Duplex I)")) { + duplexBooks++; + duplexBooksSession++; + ConfigHandler.writeIntConfig("blaze", "duplexBooks", duplexBooks); + } else if (message.contains("CRAZY RARE DROP! (High Class Archfiend Dice)")) { + rng = true; + highClassArchfiendDice++; + highClassArchfiendDiceSession++; + ConfigHandler.writeIntConfig("blaze", "highClassArchfiendDice", highClassArchfiendDice); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "HIGH CLASS ARCHFIEND DICE!", 5); + } else if (message.contains("CRAZY RARE DROP! (Wilson's Engineering Plans)")) { + rng = true; + engineeringPlans++; + engineeringPlansSession++; + ConfigHandler.writeIntConfig("blaze", "engineeringPlans", engineeringPlans); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "ENGINEERING PLANS!", 5); + } else if (message.contains("CRAZY RARE DROP! (Subzero Inverter)")) { + rng = true; + subzeroInverters++; + subzeroInvertersSession++; + ConfigHandler.writeIntConfig("blaze", "subzeroInverters", subzeroInverters); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SUBZERO INVERTER!", 5); + } + + if (rng) { + time = System.currentTimeMillis() / 1000; + bosses = 0; + timeSession = System.currentTimeMillis() / 1000; + bossesSession = 0; + ConfigHandler.writeDoubleConfig("blaze", "timeRNG", time); + ConfigHandler.writeIntConfig("blaze", "bossRNG", 0); + } + } + +} diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index aabdbd9..9d3f466 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -416,6 +416,128 @@ public class LootDisplay { EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; + case "blaze": + if (BlazeTracker.time == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(BlazeTracker.time, timeNow); + } + if (BlazeTracker.bosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(BlazeTracker.bosses); + } + + dropsText = EnumChatFormatting.GOLD + "Demonlords Killed:\n" + + EnumChatFormatting.GRAY + "Derelict Ashes:\n" + + EnumChatFormatting.RED + "Lavatear Runes:\n" + + EnumChatFormatting.AQUA + "Splash Potions:\n" + + EnumChatFormatting.DARK_RED + "Magma Arrows:\n" + + EnumChatFormatting.DARK_AQUA + "Mana Disintegrators:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Scorched Books:\n" + + EnumChatFormatting.WHITE + "Kelvin Inverters:\n" + + EnumChatFormatting.BLUE + "Blaze Rod Distillates:\n" + + EnumChatFormatting.BLUE + "Glowstone Distillates:\n" + + EnumChatFormatting.BLUE + "Magma Cream Distillates:\n" + + EnumChatFormatting.BLUE + "Nether Wart Distillates:\n" + + EnumChatFormatting.BLUE + "Gabagool Distillates:\n" + + EnumChatFormatting.RED + "Scorched Power Crystals:\n" + + EnumChatFormatting.RED + "Fire Aspect Books:\n" + + EnumChatFormatting.GOLD + "Fiery Burst Runes:\n" + + EnumChatFormatting.WHITE + "Opal Gems:\n" + + EnumChatFormatting.RED + "Archfiend Dice:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Duplex Books:\n" + + EnumChatFormatting.GOLD + "High Class Archfiend Dice:\n" + + EnumChatFormatting.GOLD + "Engineering Plans:\n" + + EnumChatFormatting.GOLD + "Subzero Inverters:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(BlazeTracker.demonlords) + "\n" + + EnumChatFormatting.GRAY + nf.format(BlazeTracker.derelictAshes) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.lavatearRunes) + "\n" + + EnumChatFormatting.AQUA + nf.format(BlazeTracker.splashPotions) + "\n" + + EnumChatFormatting.DARK_RED + nf.format(BlazeTracker.magmaArrows) + "\n" + + EnumChatFormatting.DARK_AQUA + nf.format(BlazeTracker.manaDisintegrators) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(BlazeTracker.scorchedBooks) + "\n" + + EnumChatFormatting.WHITE + nf.format(BlazeTracker.kelvinInverters) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.blazeRodDistillates) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.glowstoneDistillates) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.magmaCreamDistillates) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.netherWartDistillates) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.gabagoolDistillates) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.scorchedPowerCrystals) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.fireAspectBooks) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.fieryBurstRunes) + "\n" + + EnumChatFormatting.WHITE + nf.format(BlazeTracker.opalGems) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.archfiendDice) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(BlazeTracker.duplexBooks) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.highClassArchfiendDice) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.engineeringPlans) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.subzeroInverters) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "blaze_session": + if (BlazeTracker.timeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(BlazeTracker.timeSession, timeNow); + } + if (BlazeTracker.bossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(BlazeTracker.bossesSession); + } + + dropsText = EnumChatFormatting.GOLD + "Demonlords Killed:\n" + + EnumChatFormatting.GRAY + "Derelict Ashes:\n" + + EnumChatFormatting.RED + "Lavatear Runes:\n" + + EnumChatFormatting.AQUA + "Splash Potions:\n" + + EnumChatFormatting.DARK_RED + "Magma Arrows:\n" + + EnumChatFormatting.DARK_AQUA + "Mana Disintegrators:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Scorched Books:\n" + + EnumChatFormatting.WHITE + "Kelvin Inverters:\n" + + EnumChatFormatting.BLUE + "Blaze Rod Distillates:\n" + + EnumChatFormatting.BLUE + "Glowstone Distillates:\n" + + EnumChatFormatting.BLUE + "Magma Cream Distillates:\n" + + EnumChatFormatting.BLUE + "Nether Wart Distillates:\n" + + EnumChatFormatting.BLUE + "Gabagool Distillates:\n" + + EnumChatFormatting.RED + "Scorched Power Crystals:\n" + + EnumChatFormatting.RED + "Fire Aspect Books:\n" + + EnumChatFormatting.GOLD + "Fiery Burst Runes:\n" + + EnumChatFormatting.WHITE + "Opal Gems:\n" + + EnumChatFormatting.RED + "Archfiend Dice:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Duplex Books:\n" + + EnumChatFormatting.GOLD + "High Class Archfiend Dice:\n" + + EnumChatFormatting.GOLD + "Engineering Plans:\n" + + EnumChatFormatting.GOLD + "Subzero Inverters:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(BlazeTracker.demonlordsSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(BlazeTracker.derelictAshesSession) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.lavatearRunesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(BlazeTracker.splashPotionsSession) + "\n" + + EnumChatFormatting.DARK_RED + nf.format(BlazeTracker.magmaArrowsSession) + "\n" + + EnumChatFormatting.DARK_AQUA + nf.format(BlazeTracker.manaDisintegratorsSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(BlazeTracker.scorchedBooksSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(BlazeTracker.kelvinInvertersSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.blazeRodDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.glowstoneDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.magmaCreamDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.netherWartDistillatesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(BlazeTracker.gabagoolDistillatesSession) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.scorchedPowerCrystalsSession) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.fireAspectBooksSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.fieryBurstRunesSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(BlazeTracker.opalGemsSession) + "\n" + + EnumChatFormatting.RED + nf.format(BlazeTracker.archfiendDiceSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(BlazeTracker.duplexBooksSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.highClassArchfiendDiceSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.engineeringPlansSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(BlazeTracker.subzeroInvertersSession) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; case "fishing": if (FishingTracker.empTime == -1) { timeBetween = "Never"; diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java index 4e5974c..27f0779 100644 --- a/src/main/java/me/Danker/features/loot/LootTracker.java +++ b/src/main/java/me/Danker/features/loot/LootTracker.java @@ -31,23 +31,27 @@ public class LootTracker { int itemWebs = Utils.getItems("Tarantula Web"); int itemRev = Utils.getItems("Revenant Flesh"); int itemNullSphere = Utils.getItems("Null Sphere"); + int itemDerelictAshe = Utils.getItems("Derelict Ashe"); // If no items, are detected, allow check again. Should fix items not being found - if (itemTeeth + itemWebs + itemRev + itemNullSphere > 0) { + if (itemTeeth + itemWebs + itemRev + itemNullSphere + itemDerelictAshe > 0) { itemsChecked = System.currentTimeMillis() / 1000; WolfTracker.wolfTeeth += itemTeeth; SpiderTracker.spiderWebs += itemWebs; ZombieTracker.zombieRevFlesh += itemRev; EndermanTracker.endermanNullSpheres += itemNullSphere; + BlazeTracker.derelictAshes += itemDerelictAshe; WolfTracker.wolfTeethSession += itemTeeth; SpiderTracker.spiderWebsSession += itemWebs; ZombieTracker.zombieRevFleshSession += itemRev; EndermanTracker.endermanNullSpheresSession += itemNullSphere; + BlazeTracker.derelictAshesSession += itemDerelictAshe; ConfigHandler.writeIntConfig("wolf", "teeth", WolfTracker.wolfTeeth); ConfigHandler.writeIntConfig("spider", "web", SpiderTracker.spiderWebs); ConfigHandler.writeIntConfig("zombie", "revFlesh", ZombieTracker.zombieRevFlesh); ConfigHandler.writeIntConfig("enderman", "nullSpheres", EndermanTracker.endermanNullSpheres); + ConfigHandler.writeIntConfig("blaze", "derelictAshe", BlazeTracker.derelictAshes); } } } diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 17726f8..073b161 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -20,6 +20,7 @@ public class DisplayGui extends GuiScreen { private GuiButton spider; private GuiButton wolf; private GuiButton enderman; + private GuiButton blaze; private GuiButton auto; private GuiButton fishing; private GuiButton fishingWinter; @@ -54,10 +55,11 @@ public class DisplayGui extends GuiScreen { showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off"); auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); - zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.35), 100, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.35), 100, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.35), 100, 20, "Wolf"); - enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.35), 100, 20, "Enderman"); + zombie = new GuiButton(0, width / 2 - 270, (int) (height * 0.35), 100, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 160, (int) (height * 0.35), 100, 20, "Spider"); + wolf = new GuiButton(0, width / 2 - 50, (int) (height * 0.35), 100, 20, "Wolf"); + enderman = new GuiButton(0, width / 2 + 60, (int) (height * 0.35), 100, 20, "Enderman"); + blaze = new GuiButton(0, width / 2 + 170, (int) (height * 0.35), 100, 20, "Blaze"); fishing = new GuiButton(0, width / 2 - 270, (int) (height * 0.5), 100, 20, "Fishing"); fishingWinter = new GuiButton(0, width / 2 - 160, (int) (height * 0.5), 100, 20, "Fishing Winter"); fishingFestival = new GuiButton(0, width / 2 - 50, (int) (height * 0.5), 100, 20, "Fishing Festival"); @@ -81,6 +83,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(spider); this.buttonList.add(wolf); this.buttonList.add(enderman); + this.buttonList.add(blaze); this.buttonList.add(fishing); this.buttonList.add(fishingWinter); this.buttonList.add(fishingFestival); @@ -130,6 +133,8 @@ public class DisplayGui extends GuiScreen { setDisplay("wolf"); } else if (button == enderman) { setDisplay("enderman"); + } else if (button == blaze) { + setDisplay("blaze"); } else if (button == auto) { LootDisplay.auto = true; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index 2a6d844..c637ff9 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -19,6 +19,7 @@ public class OnlySlayerGui extends GuiScreen { private GuiButton spider; private GuiButton wolf; private GuiButton enderman; + private GuiButton blaze; private GuiButton one; private GuiButton two; private GuiButton three; @@ -60,10 +61,11 @@ public class OnlySlayerGui extends GuiScreen { goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); off = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Off"); - zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.4), 100, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.4), 100, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.4), 100, 20, "Wolf"); - enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.4), 100, 20, "Enderman"); + zombie = new GuiButton(0, width / 2 - 270, (int) (height * 0.4), 100, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 160, (int) (height * 0.4), 100, 20, "Spider"); + wolf = new GuiButton(0, width / 2 - 50, (int) (height * 0.4), 100, 20, "Wolf"); + enderman = new GuiButton(0, width / 2 + 60, (int) (height * 0.4), 100, 20, "Enderman"); + blaze = new GuiButton(0, width / 2 + 170, (int) (height * 0.4), 100, 20, "Blaze"); one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 60, 20, "I"); two = new GuiButton(0, width / 2 - 110, (int) (height * 0.6), 60, 20, "II"); three = new GuiButton(0, width / 2 - 30, (int) (height * 0.6), 60, 20, "III"); @@ -75,6 +77,7 @@ public class OnlySlayerGui extends GuiScreen { this.buttonList.add(spider); this.buttonList.add(wolf); this.buttonList.add(enderman); + this.buttonList.add(blaze); this.buttonList.add(one); this.buttonList.add(two); this.buttonList.add(three); @@ -86,7 +89,6 @@ public class OnlySlayerGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - Minecraft mc = Minecraft.getMinecraft(); String displayText; if (BlockWrongSlayer.onlySlayerName.equals("")) { @@ -117,6 +119,8 @@ public class OnlySlayerGui extends GuiScreen { onlyName = "Sven Packmaster"; } else if (button == enderman) { onlyName = "Voidgloom Seraph"; + } else if (button == blaze) { + onlyName = "Inferno Demonlord"; } else if (button == one) { onlyNumberInt = 1; } else if (button == two) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index b042177..4298c2a 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -384,7 +384,32 @@ public class ConfigHandler { EndermanTracker.endermanEnderBooks = initInt("enderman", "enderBooks", 0); EndermanTracker.endermanTime = initDouble("enderman", "timeRNG", -1); EndermanTracker.endermanBosses = initInt("enderman", "bossRNG", -1); - + // Blaze + BlazeTracker.demonlords = initInt("blaze", "demonlords", 0); + BlazeTracker.derelictAshes = initInt("blaze", "derelictAshes", 0); + BlazeTracker.lavatearRunes = initInt("blaze", "lavatearRunes", 0); + BlazeTracker.splashPotions = initInt("blaze", "splashPotions", 0); + BlazeTracker.magmaArrows = initInt("blaze", "magmaArrows", 0); + BlazeTracker.manaDisintegrators = initInt("blaze", "manaDisintegrators", 0); + BlazeTracker.scorchedBooks = initInt("blaze", "scorchedBooks", 0); + BlazeTracker.kelvinInverters = initInt("blaze", "kelvinInverters", 0); + BlazeTracker.blazeRodDistillates = initInt("blaze", "blazeRodDistillates", 0); + BlazeTracker.glowstoneDistillates = initInt("blaze", "glowstoneDistillates", 0); + BlazeTracker.magmaCreamDistillates = initInt("blaze", "magmaCreamDistillates", 0); + BlazeTracker.netherWartDistillates = initInt("blaze", "netherWartDistillates", 0); + BlazeTracker.gabagoolDistillates = initInt("blaze", "gabagoolDistillates", 0); + BlazeTracker.scorchedPowerCrystals = initInt("blaze", "scorchedPowerCrystals", 0); + BlazeTracker.fireAspectBooks = initInt("blaze", "fireAspectBooks", 0); + BlazeTracker.fieryBurstRunes = initInt("blaze", "fieryBurstRunes", 0); + BlazeTracker.opalGems = initInt("blaze", "opalGems", 0); + BlazeTracker.archfiendDice = initInt("blaze", "archfiendDice", 0); + BlazeTracker.duplexBooks = initInt("blaze", "duplexBooks", 0); + BlazeTracker.highClassArchfiendDice = initInt("blaze", "highClassArchfiendDice", 0); + BlazeTracker.engineeringPlans = initInt("blaze", "engineeringPlans", 0); + BlazeTracker.subzeroInverters = initInt("blaze", "subzeroInverters", 0); + BlazeTracker.time = initDouble("blaze", "timeRNG", -1); + BlazeTracker.bossesSession = initInt("blaze", "bossRNG", -1); + // Fishing FishingTracker.seaCreatures = initInt("fishing", "seaCreature", 0); FishingTracker.goodCatches = initInt("fishing", "goodCatch", 0); -- cgit From 0aef9021be5143adb5be5e624675d79868aa9738 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 22 Apr 2022 00:32:25 -0400 Subject: Add lava fishing tracker --- README.md | 6 +- .../java/me/Danker/commands/DisplayCommand.java | 21 +- .../me/Danker/commands/ImportFishingCommand.java | 273 +++++---------------- src/main/java/me/Danker/commands/LootCommand.java | 65 ++++- .../java/me/Danker/commands/ResetLootCommand.java | 11 + src/main/java/me/Danker/features/AutoDisplay.java | 6 +- .../me/Danker/features/loot/FishingTracker.java | 96 +++++++- .../java/me/Danker/features/loot/LootDisplay.java | 86 +++++++ src/main/java/me/Danker/gui/DisplayGui.java | 15 +- .../java/me/Danker/handlers/ConfigHandler.java | 12 + 10 files changed, 350 insertions(+), 241 deletions(-) (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/README.md b/README.md index e3b7ee8..ea32b5d 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Discord Server: https://discord.gg/QsEkNQS - Maddox menu keybind - Block starting other slayer quests - Slayer slain alert -- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing trackers +- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing, lava fishing trackers - Expertise kills in fishing rod lore - Gemstones applied in item lore - Catacombs trackers @@ -72,8 +72,8 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/festival/spooky/ch/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/ch/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /loot [winter/festival/spooky/ch/lava/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/ch/lava/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 174258d..21ada93 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/session/f(1-7)/mm]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -56,10 +56,8 @@ public class DisplayCommand extends CommandBase { return; } - boolean showSession = false; - - if (arg1[arg1.length - 1].equalsIgnoreCase("session")) showSession = true; - + boolean showSession = arg1[arg1.length - 1].equalsIgnoreCase("session"); + switch (arg1[0].toLowerCase()) { case "wolf": if (showSession) { @@ -122,9 +120,16 @@ public class DisplayCommand extends CommandBase { break; case "ch": if (showSession) { + LootDisplay.display = "fishing_ch_session"; + } else { LootDisplay.display = "fishing_ch"; + } + break; + case "lava": + if (showSession) { + LootDisplay.display = "fishing_lava_session"; } else { - LootDisplay.display = "fishing_ch_session"; + LootDisplay.display = "fishing_lava"; } break; default: @@ -230,7 +235,7 @@ public class DisplayCommand extends CommandBase { } else { LootDisplay.display = "ghost"; } - + break; case "auto": LootDisplay.auto = true; player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + "auto" + DankersSkyblockMod.MAIN_COLOUR + ".")); diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index bdd3281..f51e01f 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -77,221 +77,50 @@ public class ImportFishingCommand extends CommandBase { } FishingTracker.seaCreatures = 0; - FishingTracker.squids = 0; - if (statsObject.has("kills_pond_squid")) { - FishingTracker.squids = statsObject.get("kills_pond_squid").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.squids; - - FishingTracker.seaWalkers = 0; - if (statsObject.has("kills_sea_walker")) { - FishingTracker.seaWalkers = statsObject.get("kills_sea_walker").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.seaWalkers; - - FishingTracker.nightSquids = 0; - if (statsObject.has("kills_night_squid")) { - FishingTracker.nightSquids = statsObject.get("kills_night_squid").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.nightSquids; - - FishingTracker.seaGuardians = 0; - if (statsObject.has("kills_sea_guardian")) { - FishingTracker.seaGuardians = statsObject.get("kills_sea_guardian").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.seaGuardians; - - FishingTracker.seaWitches = 0; - if (statsObject.has("kills_sea_witch")) { - FishingTracker.seaWitches = statsObject.get("kills_sea_witch").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.seaWitches; - - FishingTracker.seaArchers = 0; - if (statsObject.has("kills_sea_archer")) { - FishingTracker.seaArchers = statsObject.get("kills_sea_archer").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.seaArchers; - - FishingTracker.monsterOfTheDeeps = 0; - if (statsObject.has("kills_zombie_deep")) { - if (statsObject.has("kills_chicken_deep")) { - FishingTracker.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt() + statsObject.get("kills_chicken_deep").getAsInt(); - } else { - FishingTracker.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt(); - } - } else if (statsObject.has("kills_chicken_deep")) { - FishingTracker.monsterOfTheDeeps = statsObject.get("kills_chicken_deep").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.monsterOfTheDeeps; - - FishingTracker.catfishes = 0; - if (statsObject.has("kills_catfish")) { - FishingTracker.catfishes = statsObject.get("kills_catfish").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.catfishes; - - FishingTracker.carrotKings = 0; - if (statsObject.has("kills_carrot_king")) { - FishingTracker.carrotKings = statsObject.get("kills_carrot_king").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.carrotKings; - - FishingTracker.seaLeeches = 0; - if (statsObject.has("kills_sea_leech")) { - FishingTracker.seaLeeches = statsObject.get("kills_sea_leech").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.seaLeeches; - - FishingTracker.guardianDefenders = 0; - if (statsObject.has("kills_guardian_defender")) { - FishingTracker.guardianDefenders = statsObject.get("kills_guardian_defender").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.guardianDefenders; - - FishingTracker.deepSeaProtectors = 0; - if (statsObject.has("kills_deep_sea_protector")) { - FishingTracker.deepSeaProtectors = statsObject.get("kills_deep_sea_protector").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.deepSeaProtectors; - - FishingTracker.hydras = 0; - if (statsObject.has("kills_water_hydra")) { - // Hydra splits - FishingTracker.hydras = statsObject.get("kills_water_hydra").getAsInt() / 2; - } - FishingTracker.seaCreatures += FishingTracker.hydras; - - FishingTracker.seaEmperors = 0; - if (statsObject.has("kills_skeleton_emperor")) { - if (statsObject.has("kills_guardian_emperor")) { - FishingTracker.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt() + statsObject.get("kills_guardian_emperor").getAsInt(); - } else { - FishingTracker.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt(); - } - } else if (statsObject.has("kills_guardian_emperor")) { - FishingTracker.seaEmperors = statsObject.get("kills_guardian_emperor").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.seaEmperors; - - FishingTracker.fishingMilestone = 0; - if (statsObject.has("pet_milestone_sea_creatures_killed")) { - FishingTracker.fishingMilestone = statsObject.get("pet_milestone_sea_creatures_killed").getAsInt(); - } - - FishingTracker.frozenSteves = 0; - if (statsObject.has("kills_frozen_steve")) { - FishingTracker.frozenSteves = statsObject.get("kills_frozen_steve").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.frozenSteves; - - FishingTracker.frostyTheSnowmans = 0; - if (statsObject.has("kills_frosty_the_snowman")) { - FishingTracker.frostyTheSnowmans = statsObject.get("kills_frosty_the_snowman").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.frostyTheSnowmans; - - FishingTracker.grinches = 0; - if (statsObject.has("kills_grinch")) { - FishingTracker.grinches = statsObject.get("kills_grinch").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.grinches; - - FishingTracker.yetis = 0; - if (statsObject.has("kills_yeti")) { - FishingTracker.yetis = statsObject.get("kills_yeti").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.yetis; - - FishingTracker.nurseSharks = 0; - if (statsObject.has("kills_nurse_shark")) { - FishingTracker.nurseSharks = statsObject.get("kills_nurse_shark").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.nurseSharks; - - FishingTracker.blueSharks = 0; - if (statsObject.has("kills_nurse_shark")) { - FishingTracker.blueSharks = statsObject.get("kills_blue_shark").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.blueSharks; - - FishingTracker.tigerSharks = 0; - if (statsObject.has("kills_nurse_shark")) { - FishingTracker.tigerSharks = statsObject.get("kills_tiger_shark").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.tigerSharks; - - FishingTracker.greatWhiteSharks = 0; - if (statsObject.has("kills_nurse_shark")) { - FishingTracker.greatWhiteSharks = statsObject.get("kills_great_white_shark").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.greatWhiteSharks; - - FishingTracker.scarecrows = 0; - if (statsObject.has("kills_scarecrow")) { - FishingTracker.scarecrows = statsObject.get("kills_scarecrow").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.scarecrows; - - FishingTracker.nightmares = 0; - if (statsObject.has("kills_nightmare")) { - FishingTracker.nightmares = statsObject.get("kills_nightmare").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.nightmares; - - FishingTracker.werewolfs = 0; - if (statsObject.has("kills_werewolf")) { - FishingTracker.werewolfs = statsObject.get("kills_werewolf").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.werewolfs; - - FishingTracker.phantomFishers = 0; - if (statsObject.has("kills_phantom_fisherman")) { - FishingTracker.phantomFishers = statsObject.get("kills_phantom_fisherman").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.phantomFishers; - - FishingTracker.grimReapers = 0; - if (statsObject.has("kills_grim_reaper")) { - FishingTracker.grimReapers = statsObject.get("kills_grim_reaper").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.grimReapers; - - FishingTracker.waterWorms = 0; - if (statsObject.has("kills_water_worm")) { - FishingTracker.waterWorms = statsObject.get("kills_water_worm").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.waterWorms; - - FishingTracker.poisonedWaterWorms = 0; - if (statsObject.has("kills_poisoned_water_worm")) { - FishingTracker.poisonedWaterWorms = statsObject.get("kills_poisoned_water_worm").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.poisonedWaterWorms; - FishingTracker.flamingWorms = 0; - if (statsObject.has("kills_flaming_worm")) { - FishingTracker.flamingWorms = statsObject.get("kills_flaming_worm").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.flamingWorms; - - FishingTracker.lavaBlazes = 0; - if (statsObject.has("kills_lava_blaze")) { - FishingTracker.lavaBlazes = statsObject.get("kills_lava_blaze").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.lavaBlazes; - - FishingTracker.lavaPigmen = 0; - if (statsObject.has("kills_lava_pigman")) { - FishingTracker.lavaPigmen = statsObject.get("kills_lava_pigman").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.lavaPigmen; - - FishingTracker.zombieMiners = 0; - if (statsObject.has("kills_zombie_miner")) { - FishingTracker.zombieMiners = statsObject.get("kills_zombie_miner").getAsInt(); - } - FishingTracker.seaCreatures += FishingTracker.zombieMiners; + FishingTracker.squids = getSCFromApi(statsObject, "kills_pond_squid"); + FishingTracker.seaWalkers = getSCFromApi(statsObject, "kills_sea_walker"); + FishingTracker.nightSquids = getSCFromApi(statsObject, "kills_night_squid"); + FishingTracker.seaGuardians = getSCFromApi(statsObject, "kills_sea_guardian"); + FishingTracker.seaWitches = getSCFromApi(statsObject, "kills_sea_witch"); + FishingTracker.seaArchers = getSCFromApi(statsObject, "kills_sea_archer"); + FishingTracker.monsterOfTheDeeps = getSCFromApi(statsObject, "kills_zombie_deep") + getSCFromApi(statsObject, "kills_chicken_deep"); + FishingTracker.catfishes = getSCFromApi(statsObject, "kills_catfish"); + FishingTracker.carrotKings = getSCFromApi(statsObject, "kills_carrot_king"); + FishingTracker.seaLeeches = getSCFromApi(statsObject, "kills_sea_leech"); + FishingTracker.guardianDefenders = getSCFromApi(statsObject, "kills_guardian_defender"); + FishingTracker.deepSeaProtectors = getSCFromApi(statsObject, "kills_deep_sea_protector"); + FishingTracker.hydras = getSCFromApi(statsObject, "kills_water_hydra") / 2; + FishingTracker.seaEmperors = getSCFromApi(statsObject, "kills_skeleton_emperor") + getSCFromApi(statsObject, "kills_guardian_emperor"); + FishingTracker.fishingMilestone = getSCFromApi(statsObject, "pet_milestone_sea_creatures_killed"); + FishingTracker.frozenSteves = getSCFromApi(statsObject, "kills_frozen_steve"); + FishingTracker.frostyTheSnowmans = getSCFromApi(statsObject, "kills_frosty_the_snowman"); + FishingTracker.grinches = getSCFromApi(statsObject, "kills_grinch"); + FishingTracker.yetis = getSCFromApi(statsObject, "kills_yeti"); + FishingTracker.nurseSharks = getSCFromApi(statsObject, "kills_nurse_shark"); + FishingTracker.blueSharks = getSCFromApi(statsObject, "kills_blue_shark"); + FishingTracker.tigerSharks = getSCFromApi(statsObject, "kills_tiger_shark"); + FishingTracker.greatWhiteSharks = getSCFromApi(statsObject, "kills_great_white_shark"); + FishingTracker.scarecrows = getSCFromApi(statsObject, "kills_scarecrow"); + FishingTracker.nightmares = getSCFromApi(statsObject, "kills_nightmare"); + FishingTracker.werewolfs = getSCFromApi(statsObject, "kills_werewolf"); + FishingTracker.phantomFishers = getSCFromApi(statsObject, "kills_phantom_fisherman"); + FishingTracker.grimReapers = getSCFromApi(statsObject, "kills_grim_reaper"); + FishingTracker.waterWorms = getSCFromApi(statsObject, "kills_water_worm"); + FishingTracker.poisonedWaterWorms = getSCFromApi(statsObject, "kills_poisoned_water_worm"); + FishingTracker.flamingWorms = getSCFromApi(statsObject, "kills_flaming_worm"); + FishingTracker.lavaBlazes = getSCFromApi(statsObject, "kills_lava_blaze"); + FishingTracker.lavaPigmen = getSCFromApi(statsObject, "kills_lava_pigman"); + FishingTracker.zombieMiners = getSCFromApi(statsObject, "kills_zombie_miner"); + FishingTracker.magmaSlugs = getSCFromApi(statsObject, "kills_magma_slug"); + FishingTracker.moogmas = getSCFromApi(statsObject, "kills_moogma"); + FishingTracker.lavaLeeches = getSCFromApi(statsObject, "kills_lava_leech"); + FishingTracker.pyroclasticWorms = getSCFromApi(statsObject, "kills_pyroclastic_worm"); + FishingTracker.lavaFlames = getSCFromApi(statsObject, "kills_lava_flame"); + FishingTracker.fireEels = getSCFromApi(statsObject, "kills_fire_eel"); + FishingTracker.tauruses = getSCFromApi(statsObject, "kills_taurus"); + FishingTracker.thunders = getSCFromApi(statsObject, "kills_thunder"); + FishingTracker.lordJawbuses = getSCFromApi(statsObject, "kills_lord_jawbus"); System.out.println("Writing to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); @@ -331,9 +160,25 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "lavaBlaze", FishingTracker.lavaBlazes); ConfigHandler.writeIntConfig("fishing", "lavaPigman", FishingTracker.lavaPigmen); ConfigHandler.writeIntConfig("fishing", "zombieMiner", FishingTracker.zombieMiners); + ConfigHandler.writeIntConfig("fishing", "magmaSlug", FishingTracker.magmaSlugs); + ConfigHandler.writeIntConfig("fishing", "moogma", FishingTracker.moogmas); + ConfigHandler.writeIntConfig("fishing", "lavaLeech", FishingTracker.lavaLeeches); + ConfigHandler.writeIntConfig("fishing", "pyroclasticWorm", FishingTracker.pyroclasticWorms); + ConfigHandler.writeIntConfig("fishing", "lavaFlame", FishingTracker.lavaFlames); + ConfigHandler.writeIntConfig("fishing", "fireEel", FishingTracker.fireEels); + ConfigHandler.writeIntConfig("fishing", "taurus", FishingTracker.tauruses); + ConfigHandler.writeIntConfig("fishing", "thunder", FishingTracker.thunders); + ConfigHandler.writeIntConfig("fishing", "lordJawbus", FishingTracker.lordJawbuses); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } + static int getSCFromApi(JsonObject obj, String key) { + int sc = 0; + if (obj.has(key)) sc = obj.get(key).getAsInt(); + FishingTracker.seaCreatures += sc; + return sc; + } + } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 5d91573..3be46a4 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/f(1-7)/mm/session]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +41,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -511,6 +511,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Tiger Sharks: " + nf.format(FishingTracker.tigerSharks) + "\n" + EnumChatFormatting.WHITE + " Great White Sharks: " + nf.format(FishingTracker.greatWhiteSharks) + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; } else if (arg1[1].equalsIgnoreCase("spooky")) { if (showSession) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + @@ -532,6 +533,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Phantom Fishers: " + nf.format(FishingTracker.phantomFishers) + "\n" + EnumChatFormatting.GOLD + " Grim Reapers: " + nf.format(FishingTracker.grimReapers) + "\n" + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); + return; } else if (arg1[1].equalsIgnoreCase("ch")) { if (showSession) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + @@ -556,9 +558,64 @@ public class LootCommand extends CommandBase { EnumChatFormatting.LIGHT_PURPLE + " Lava Pigmen: " + nf.format(FishingTracker.lavaPigmen) + "\n" + EnumChatFormatting.GOLD + " Zombie Miners: " + nf.format(FishingTracker.zombieMiners) + "\n" + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); - } + return; + } else if (arg1[1].equalsIgnoreCase("lava")) { + if (showSession) { + if (FishingTracker.jawbusTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(FishingTracker.jawbusTimeSession, timeNow); + } + if (FishingTracker.jawbusSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(FishingTracker.jawbusSCsSession); + } - return; + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Lava Fishing Summary (Current Session):\n" + + EnumChatFormatting.DARK_RED + " Magma Slugs: " + nf.format(FishingTracker.magmaSlugsSession) + "\n" + + EnumChatFormatting.RED + " Moogmas: " + nf.format(FishingTracker.moogmasSession) + "\n" + + EnumChatFormatting.RED + " Lava Leeches: " + nf.format(FishingTracker.lavaLeechesSession) + "\n" + + EnumChatFormatting.RED + " Pyroclastic Worms: " + nf.format(FishingTracker.pyroclasticWormsSession) + "\n" + + EnumChatFormatting.DARK_RED + " Lava Flames: " + nf.format(FishingTracker.lavaFlamesSession) + "\n" + + EnumChatFormatting.RED + " Fire Eels: " + nf.format(FishingTracker.fireEelsSession) + "\n" + + EnumChatFormatting.GOLD + " Tauruses: " + nf.format(FishingTracker.taurusesSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Thunders: " + nf.format(FishingTracker.thundersSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lord Jawbuses: " + nf.format(FishingTracker.lordJawbusesSession) + "\n" + + EnumChatFormatting.AQUA + " Time Since Lord Jawbus: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Creatures Since Lord Jawbus: " + bossesBetween + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; + } + + if (FishingTracker.jawbusTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(FishingTracker.jawbusTime, timeNow); + } + if (FishingTracker.jawbusSCs == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(FishingTracker.jawbusSCs); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Lava Fishing Summary:\n" + + EnumChatFormatting.DARK_RED + " Magma Slugs: " + nf.format(FishingTracker.magmaSlugs) + "\n" + + EnumChatFormatting.RED + " Moogmas: " + nf.format(FishingTracker.moogmas) + "\n" + + EnumChatFormatting.RED + " Lava Leeches: " + nf.format(FishingTracker.lavaLeeches) + "\n" + + EnumChatFormatting.RED + " Pyroclastic Worms: " + nf.format(FishingTracker.pyroclasticWorms) + "\n" + + EnumChatFormatting.DARK_RED + " Lava Flames: " + nf.format(FishingTracker.lavaFlames) + "\n" + + EnumChatFormatting.RED + " Fire Eels: " + nf.format(FishingTracker.fireEels) + "\n" + + EnumChatFormatting.GOLD + " Tauruses: " + nf.format(FishingTracker.tauruses) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Thunders: " + nf.format(FishingTracker.thunders) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lord Jawbuses: " + nf.format(FishingTracker.lordJawbuses) + "\n" + + EnumChatFormatting.AQUA + " Time Since Lord Jawbus: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Creatures Since Lord Jawbus: " + bossesBetween + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; + } } if (showSession) { diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index d3294b2..c17c2ae 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -277,6 +277,17 @@ public class ResetLootCommand extends CommandBase { FishingTracker.lavaBlazesSession = 0; FishingTracker.lavaPigmenSession = 0; FishingTracker.zombieMinersSession = 0; + FishingTracker.magmaSlugsSession = 0; + FishingTracker.moogmasSession = 0; + FishingTracker.lavaLeechesSession = 0; + FishingTracker.pyroclasticWormsSession = 0; + FishingTracker.lavaFlamesSession = 0; + FishingTracker.fireEelsSession = 0; + FishingTracker.taurusesSession = 0; + FishingTracker.thundersSession = 0; + FishingTracker.lordJawbusesSession = 0; + FishingTracker.jawbusTimeSession = 0; + FishingTracker.jawbusSCsSession = 0; ConfigHandler.deleteCategory("fishing"); ConfigHandler.reloadConfig(); } diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 63b66d5..7f86035 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -95,7 +95,11 @@ public class AutoDisplay { List lore = hotbarItem.getTooltip(player, mc.gameSettings.advancedItemTooltips); for (int j = lore.size() - 1; j >= 0; j--) { // reverse if (lore.get(j).contains("FISHING ROD")) { - LootDisplay.display = "fishing"; + if (Utils.tabLocation.equals("Crimson Isle")) { + LootDisplay.display = "fishing_lava"; + } else { + LootDisplay.display = "fishing"; + } found = true; break; } diff --git a/src/main/java/me/Danker/features/loot/FishingTracker.java b/src/main/java/me/Danker/features/loot/FishingTracker.java index cf329aa..95a9040 100644 --- a/src/main/java/me/Danker/features/loot/FishingTracker.java +++ b/src/main/java/me/Danker/features/loot/FishingTracker.java @@ -54,6 +54,18 @@ public class FishingTracker { public static int lavaBlazes; public static int lavaPigmen; public static int zombieMiners; + // Lava fishing + public static int magmaSlugs; + public static int moogmas; + public static int lavaLeeches; + public static int pyroclasticWorms; + public static int lavaFlames; + public static int fireEels; + public static int tauruses; + public static int thunders; + public static int lordJawbuses; + public static double jawbusTime; + public static int jawbusSCs; // Fishing public static int seaCreaturesSession = 0; @@ -101,6 +113,18 @@ public class FishingTracker { public static int lavaBlazesSession = 0; public static int lavaPigmenSession = 0; public static int zombieMinersSession = 0; + // Lava fishing + public static int magmaSlugsSession = 0; + public static int moogmasSession = 0; + public static int lavaLeechesSession = 0; + public static int pyroclasticWormsSession = 0; + public static int lavaFlamesSession = 0; + public static int fireEelsSession = 0; + public static int taurusesSession = 0; + public static int thundersSession = 0; + public static int lordJawbusesSession = 0; + public static double jawbusTimeSession = 0; + public static int jawbusSCsSession = 0; @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { @@ -296,16 +320,61 @@ public class FishingTracker { zombieMinersSession++; ConfigHandler.writeIntConfig("fishing", "zombieMiner", zombieMiners); increaseSeaCreatures(); + } else if (message.contains("From Beneath the lava appears a Magma Slug")) { + magmaSlugs++; + magmaSlugsSession++; + ConfigHandler.writeIntConfig("fishing", "magmaSlug", magmaSlugs); + increaseSeaCreatures(); + } else if (message.contains("You hear a faint Moo from the lava... A Moogma appears")) { + moogmas++; + moogmasSession++; + ConfigHandler.writeIntConfig("fishing", "moogma", moogmas); + increaseSeaCreatures(); + } else if (message.contains("A small but fearsome Lava Leech emerges")) { + lavaLeeches++; + lavaLeechesSession++; + ConfigHandler.writeIntConfig("fishing", "lavaLeech", lavaLeeches); + increaseSeaCreatures(); + } else if (message.contains("You feel the heat radiating as a Pyroclastic Worm surfaces")) { + pyroclasticWorms++; + pyroclasticWormsSession++; + ConfigHandler.writeIntConfig("fishing", "pyroclasticWorm", pyroclasticWorms); + increaseSeaCreatures(); + } else if (message.contains("A Lava Flame flies out from beneath the lava")) { + lavaFlames++; + lavaFlamesSession++; + ConfigHandler.writeIntConfig("fishing", "lavaFlame", lavaFlames); + increaseSeaCreatures(); + } else if (message.contains("A Fire Eel slithers out from the depths")) { + fireEels++; + fireEelsSession++; + ConfigHandler.writeIntConfig("fishing", "fireEel", fireEels); + increaseSeaCreatures(); + } else if (message.contains("Taurus and his steed emerge")) { + tauruses++; + taurusesSession++; + ConfigHandler.writeIntConfig("fishing", "taurus", tauruses); + increaseSeaCreatures(); + } else if (message.contains("You hear a massive rumble as Thunder emerges")) { + thunders++; + thundersSession++; + ConfigHandler.writeIntConfig("fishing", "thunder", thunders); + increaseSeaCreatures(); + } else if (message.contains("You have angered a legendary creature... Lord Jawbus has arrived")) { + lordJawbuses++; + jawbusTime = System.currentTimeMillis() / 1000; + jawbusSCs = 0; + lordJawbusesSession++; + jawbusTimeSession = System.currentTimeMillis() / 1000; + jawbusSCsSession = 0; + ConfigHandler.writeIntConfig("fishing", "lordJawbus", lordJawbuses); + ConfigHandler.writeDoubleConfig("fishing", "jawbusTime", jawbusTime); + ConfigHandler.writeIntConfig("fishing", "jawbusSC", jawbusSCs); + increaseSeaCreatures(); } } public void increaseSeaCreatures() { - if (empSCs != -1) { - empSCs++; - } - if (empSCsSession != -1) { - empSCsSession++; - } // Only increment Yetis when in Jerry's Workshop if (Utils.isInScoreboard("Jerry's Workshop") || Utils.isInScoreboard("Jerry Pond")) { if (yetiSCs != -1) { @@ -314,6 +383,20 @@ public class FishingTracker { if (yetiSCsSession != -1) { yetiSCsSession++; } + } else if (Utils.tabLocation.equals("Crimson Isle")) { + if (jawbusSCs != -1) { + jawbusSCs++; + } + if (jawbusSCsSession != -1) { + jawbusSCsSession++; + } + } else { + if (empSCs != -1) { + empSCs++; + } + if (empSCsSession != -1) { + empSCsSession++; + } } seaCreatures++; @@ -324,6 +407,7 @@ public class FishingTracker { ConfigHandler.writeIntConfig("fishing", "milestone", fishingMilestone); ConfigHandler.writeIntConfig("fishing", "empSC", empSCs); ConfigHandler.writeIntConfig("fishing", "yetiSC", yetiSCs); + ConfigHandler.writeIntConfig("fishing", "jawbusSC", jawbusSCs); } } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 9436ec6..e1ddcb0 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -848,6 +848,92 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaPigmenSession) + "\n" + EnumChatFormatting.GOLD + nf.format(FishingTracker.zombieMinersSession); break; + case "fishing_lava": + if (FishingTracker.jawbusTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(FishingTracker.jawbusTime, timeNow); + } + if (FishingTracker.jawbusSCs == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(FishingTracker.jawbusSCs); + } + + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.DARK_RED + "Magma Slugs:\n" + + EnumChatFormatting.RED + "Moogmas:\n" + + EnumChatFormatting.RED + "Lava Leeches:\n" + + EnumChatFormatting.RED + "Pyroclastic Worms:\n" + + EnumChatFormatting.DARK_RED + "Lava Flames:\n" + + EnumChatFormatting.RED + "Fire Eels:\n" + + EnumChatFormatting.GOLD + "Tauruses:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Thunders:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Lord Jawbuses:\n" + + EnumChatFormatting.AQUA + "Time Since Jawbus:\n" + + EnumChatFormatting.AQUA + "SC Since Jawbus:"; + countText = EnumChatFormatting.AQUA + nf.format(FishingTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(FishingTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.greatCatches) + "\n" + + EnumChatFormatting.DARK_RED + nf.format(FishingTracker.magmaSlugs) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.moogmas) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.lavaLeeches) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.pyroclasticWorms) + "\n" + + EnumChatFormatting.DARK_RED + nf.format(FishingTracker.lavaFlames) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.fireEels) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.tauruses) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(FishingTracker.thunders) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(FishingTracker.lordJawbuses) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "fishing_lava_session": + if (FishingTracker.jawbusTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(FishingTracker.jawbusTimeSession, timeNow); + } + if (FishingTracker.jawbusSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(FishingTracker.jawbusSCsSession); + } + + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.DARK_RED + "Magma Slugs:\n" + + EnumChatFormatting.RED + "Moogmas:\n" + + EnumChatFormatting.RED + "Lava Leeches:\n" + + EnumChatFormatting.RED + "Pyroclastic Worms:\n" + + EnumChatFormatting.DARK_RED + "Lava Flames:\n" + + EnumChatFormatting.RED + "Fire Eels:\n" + + EnumChatFormatting.GOLD + "Tauruses:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Thunders:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Lord Jawbuses:\n" + + EnumChatFormatting.AQUA + "Time Since Jawbus:\n" + + EnumChatFormatting.AQUA + "SC Since Jawbus:"; + countText = EnumChatFormatting.AQUA + nf.format(FishingTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(FishingTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.DARK_RED + nf.format(FishingTracker.magmaSlugsSession) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.moogmasSession) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.lavaLeechesSession) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.pyroclasticWormsSession) + "\n" + + EnumChatFormatting.DARK_RED + nf.format(FishingTracker.lavaFlamesSession) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.fireEelsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.taurusesSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(FishingTracker.thundersSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(FishingTracker.lordJawbusesSession) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 073b161..b8be3d6 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -27,6 +27,7 @@ public class DisplayGui extends GuiScreen { private GuiButton fishingFestival; private GuiButton fishingSpooky; private GuiButton fishingCH; + private GuiButton fishingLava; private GuiButton catacombsF1; private GuiButton catacombsF2; private GuiButton catacombsF3; @@ -60,11 +61,12 @@ public class DisplayGui extends GuiScreen { wolf = new GuiButton(0, width / 2 - 50, (int) (height * 0.35), 100, 20, "Wolf"); enderman = new GuiButton(0, width / 2 + 60, (int) (height * 0.35), 100, 20, "Enderman"); blaze = new GuiButton(0, width / 2 + 170, (int) (height * 0.35), 100, 20, "Blaze"); - fishing = new GuiButton(0, width / 2 - 270, (int) (height * 0.5), 100, 20, "Fishing"); - fishingWinter = new GuiButton(0, width / 2 - 160, (int) (height * 0.5), 100, 20, "Fishing Winter"); - fishingFestival = new GuiButton(0, width / 2 - 50, (int) (height * 0.5), 100, 20, "Fishing Festival"); - fishingSpooky = new GuiButton(0, width / 2 + 60, (int) (height * 0.5), 100, 20, "Fishing Spooky"); - fishingCH = new GuiButton(0, width / 2 + 170, (int) (height * 0.5), 100, 20, "CH Fishing"); + fishing = new GuiButton(0, width / 2 - 295, (int) (height * 0.5), 90, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 195, (int) (height * 0.5), 90, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 - 95, (int) (height * 0.5), 90, 20, "Fishing Festival"); + fishingSpooky = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 90, 20, "Fishing Spooky"); + fishingCH = new GuiButton(0, width / 2 + 105, (int) (height * 0.5), 90, 20, "CH Fishing"); + fishingLava = new GuiButton(0, width / 2 + 205, (int) (height * 0.5), 90, 20, "Lava Fishing"); catacombsF1 = new GuiButton(0, width / 2 - 235, (int) (height * 0.65), 50, 20, "F1"); catacombsF2 = new GuiButton(0, width / 2 - 175, (int) (height * 0.65), 50, 20, "F2"); catacombsF3 = new GuiButton(0, width / 2 - 115, (int) (height * 0.65), 50, 20, "F3"); @@ -89,6 +91,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(fishingFestival); this.buttonList.add(fishingSpooky); this.buttonList.add(fishingCH); + this.buttonList.add(fishingLava); this.buttonList.add(catacombsF1); this.buttonList.add(catacombsF2); this.buttonList.add(catacombsF3); @@ -148,6 +151,8 @@ public class DisplayGui extends GuiScreen { setDisplay("fishing_spooky"); } else if (button == fishingCH) { setDisplay("fishing_ch"); + } else if (button == fishingLava) { + setDisplay("fishing_lava"); } else if (button == mythological) { setDisplay("mythological"); } else if (button == catacombsF1) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index a4d7ca9..1267b9b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -456,6 +456,18 @@ public class ConfigHandler { FishingTracker.lavaBlazes = initInt("fishing", "lavaBlaze", 0); FishingTracker.lavaPigmen = initInt("fishing", "lavaPigman", 0); FishingTracker.zombieMiners = initInt("fishing", "zombieMiner", 0); + // Lava Fishing + FishingTracker.magmaSlugs = initInt("fishing", "magmaSlug", 0); + FishingTracker.moogmas = initInt("fishing", "moogma", 0); + FishingTracker.lavaLeeches = initInt("fishing", "lavaLeech", 0); + FishingTracker.pyroclasticWorms = initInt("fishing", "pyroclasticWorm", 0); + FishingTracker.lavaFlames = initInt("fishing", "lavaFlame", 0); + FishingTracker.fireEels = initInt("fishing", "fireEel", 0); + FishingTracker.tauruses = initInt("fishing", "taurus", 0); + FishingTracker.thunders = initInt("fishing", "thunder", 0); + FishingTracker.lordJawbuses = initInt("fishing", "lordJawbus", 0); + FishingTracker.jawbusTime = initDouble("fishing", "jawbusTime", -1); + FishingTracker.jawbusSCs = initInt("fishing", "jawbusSC", -1); // Mythological MythologicalTracker.mythCoins = initDouble("mythological", "coins", 0); -- cgit From abd656382da708b8cd77df1f4f0a74f2287618c5 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 5 Aug 2022 00:30:35 -0400 Subject: Add trophy fishing tracker Also update trivia answers and add mod init event --- README.md | 6 +- src/main/java/me/Danker/DankersSkyblockMod.java | 11 +- .../java/me/Danker/commands/DisplayCommand.java | 11 +- .../me/Danker/commands/ImportFishingCommand.java | 39 ++++++- src/main/java/me/Danker/commands/LootCommand.java | 52 ++++++++- .../java/me/Danker/commands/ResetLootCommand.java | 4 + src/main/java/me/Danker/events/ModInitEvent.java | 13 +++ src/main/java/me/Danker/features/Alerts.java | 6 ++ src/main/java/me/Danker/features/ChatAliases.java | 6 ++ src/main/java/me/Danker/features/CustomMusic.java | 7 ++ .../java/me/Danker/features/GemstonesLore.java | 4 +- .../java/me/Danker/features/GoldenEnchants.java | 4 +- .../me/Danker/features/MinionLastCollected.java | 6 ++ .../java/me/Danker/features/loot/LootDisplay.java | 76 +++++++++++++ .../me/Danker/features/loot/TrophyFishTracker.java | 120 +++++++++++++++++++++ .../features/puzzlesolvers/TriviaSolver.java | 11 +- src/main/java/me/Danker/gui/DisplayGui.java | 18 ++-- .../java/me/Danker/handlers/ConfigHandler.java | 11 +- src/main/java/me/Danker/utils/Utils.java | 12 +++ 19 files changed, 386 insertions(+), 31 deletions(-) create mode 100644 src/main/java/me/Danker/events/ModInitEvent.java create mode 100644 src/main/java/me/Danker/features/loot/TrophyFishTracker.java (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/README.md b/README.md index 98bf434..624989f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Discord Server: https://discord.gg/QsEkNQS - Maddox menu keybind - Block starting other slayer quests - Slayer slain alert -- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing, lava fishing trackers +- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing, lava fishing, trophy fishing trackers - Expertise kills in fishing rod lore - Gemstones applied in item lore - Catacombs trackers @@ -87,8 +87,8 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/festival/spooky/ch/lava/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/ch/lava/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /loot [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index a63552c..6322c33 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import me.Danker.commands.*; import me.Danker.events.ChestSlotClickedEvent; import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.events.ModInitEvent; import me.Danker.events.RenderOverlayEvent; import me.Danker.features.*; import me.Danker.features.loot.*; @@ -177,18 +178,12 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new GhostTracker()); MinecraftForge.EVENT_BUS.register(new MythologicalTracker()); MinecraftForge.EVENT_BUS.register(new SpiderTracker()); + MinecraftForge.EVENT_BUS.register(new TrophyFishTracker()); MinecraftForge.EVENT_BUS.register(new WolfTracker()); MinecraftForge.EVENT_BUS.register(new ZombieTracker()); - Alerts.configFile = configDirectory + "/dsmalerts.json"; - ChatAliases.configFile = configDirectory + "/dsmaliases.json"; - MinionLastCollected.configFile = configDirectory + "/dsmminions.json"; - + MinecraftForge.EVENT_BUS.post(new ModInitEvent(configDirectory)); ConfigHandler.reloadConfig(); - GoldenEnchants.init(); - TriviaSolver.init(); - CustomMusic.init(configDirectory); - GemstonesLore.init(); keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); keyBindings[1] = new KeyBinding("Regular Ability", Keyboard.KEY_NUMPAD4, "Danker's Skyblock Mod"); diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 21ada93..c340ed8 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/session/f(1-7)/mm]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/trophy/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -132,6 +132,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "fishing_lava"; } break; + case "trophy": + if (showSession) { + LootDisplay.display = "fishing_trophy_session"; + } else { + LootDisplay.display = "fishing_trophy"; + } + break; default: if (showSession) { LootDisplay.display = "fishing_session"; diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 46d9906..6658bcd 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -3,6 +3,7 @@ package me.Danker.commands; import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.FishingTracker; +import me.Danker.features.loot.TrophyFishTracker; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; @@ -63,7 +64,9 @@ public class ImportFishingCommand extends CommandBase { } System.out.println("Fetching fishing stats..."); - JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject(); + JsonObject memberObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); + JsonObject statsObject = memberObject.get("stats").getAsJsonObject(); + JsonObject trophyObject = memberObject.get("trophy_fish").getAsJsonObject(); FishingTracker.greatCatches = 0; FishingTracker.goodCatches = 0; @@ -123,7 +126,7 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.thunders = getSCFromApi(statsObject, "kills_thunder"); FishingTracker.lordJawbuses = getSCFromApi(statsObject, "kills_lord_jawbus"); - System.out.println("Writing to config..."); + System.out.println("Writing SC to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); ConfigHandler.writeIntConfig("fishing", "greatCatch", FishingTracker.greatCatches); ConfigHandler.writeIntConfig("fishing", "seaCreature", FishingTracker.seaCreatures); @@ -172,6 +175,27 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "thunder", FishingTracker.thunders); ConfigHandler.writeIntConfig("fishing", "lordJawbus", FishingTracker.lordJawbuses); + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fish.add("Sulpher Skitter", getTrophyFromAPI(trophyObject, "sulphur_skitter")); + TrophyFishTracker.fish.add("Obfuscated 1", getTrophyFromAPI(trophyObject, "obfuscated_fish_1")); + TrophyFishTracker.fish.add("Steaming-Hot Flounder", getTrophyFromAPI(trophyObject, "steaming_hot_flounder")); + TrophyFishTracker.fish.add("Obfuscated 2", getTrophyFromAPI(trophyObject, "obfuscated_fish_2")); + TrophyFishTracker.fish.add("Gusher", getTrophyFromAPI(trophyObject, "gusher")); + TrophyFishTracker.fish.add("Blobfish", getTrophyFromAPI(trophyObject, "blobfish")); + TrophyFishTracker.fish.add("Slugfish", getTrophyFromAPI(trophyObject, "slugfish")); + TrophyFishTracker.fish.add("Obfuscated 3", getTrophyFromAPI(trophyObject, "obfuscated_fish_3")); + TrophyFishTracker.fish.add("Flyfish", getTrophyFromAPI(trophyObject, "flyfish")); + TrophyFishTracker.fish.add("Lavahorse", getTrophyFromAPI(trophyObject, "lava_horse")); + TrophyFishTracker.fish.add("Mana Ray", getTrophyFromAPI(trophyObject, "mana_ray")); + TrophyFishTracker.fish.add("Volcanic Stonefish", getTrophyFromAPI(trophyObject, "volcanic_stonefish")); + TrophyFishTracker.fish.add("Vanille", getTrophyFromAPI(trophyObject, "vanille")); + TrophyFishTracker.fish.add("Skeleton Fish", getTrophyFromAPI(trophyObject, "skeleton_fish")); + TrophyFishTracker.fish.add("Moldfin", getTrophyFromAPI(trophyObject, "moldfin")); + TrophyFishTracker.fish.add("Soul Fish", getTrophyFromAPI(trophyObject, "soul_fish")); + TrophyFishTracker.fish.add("Karate Fish", getTrophyFromAPI(trophyObject, "karate_fish")); + TrophyFishTracker.fish.add("Golden Fish", getTrophyFromAPI(trophyObject, "golden_fish")); + TrophyFishTracker.save(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } @@ -183,4 +207,15 @@ public class ImportFishingCommand extends CommandBase { return sc; } + static JsonObject getTrophyFromAPI(JsonObject obj, String name) { + JsonObject tiers = new JsonObject(); + + tiers.addProperty("BRONZE", obj.has(name + "_bronze") ? obj.get(name + "_bronze").getAsInt() : 0); + tiers.addProperty("SILVER", obj.has(name + "_silver") ? obj.get(name + "_silver").getAsInt() : 0); + tiers.addProperty("GOLD", obj.has(name + "_gold") ? obj.get(name + "_gold").getAsInt() : 0); + tiers.addProperty("DIAMOND", obj.has(name + "_diamond") ? obj.get(name + "_diamond").getAsInt() : 0); + + return tiers; + } + } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index af5479e..3c224bb 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/f(1-7)/mm/session]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +41,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -621,6 +621,54 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Creatures Since Lord Jawbus: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; + } else if (arg1[1].equalsIgnoreCase("trophy")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary (Current Session):\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary:\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 9ccef33..00cf8f6 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -293,6 +293,10 @@ public class ResetLootCommand extends CommandBase { FishingTracker.jawbusSCsSession = -1; ConfigHandler.deleteCategory("fishing"); ConfigHandler.reloadConfig(); + + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fishSession = TrophyFishTracker.createEmpty(); + TrophyFishTracker.save(); } static void resetMythological() { diff --git a/src/main/java/me/Danker/events/ModInitEvent.java b/src/main/java/me/Danker/events/ModInitEvent.java new file mode 100644 index 0000000..e1cc644 --- /dev/null +++ b/src/main/java/me/Danker/events/ModInitEvent.java @@ -0,0 +1,13 @@ +package me.Danker.events; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class ModInitEvent extends Event { + + public final String configDirectory; + + public ModInitEvent(String configDirectory) { + this.configDirectory = configDirectory; + } + +} diff --git a/src/main/java/me/Danker/features/Alerts.java b/src/main/java/me/Danker/features/Alerts.java index 8f45423..e54a212 100644 --- a/src/main/java/me/Danker/features/Alerts.java +++ b/src/main/java/me/Danker/features/Alerts.java @@ -3,6 +3,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; import javafx.scene.control.Alert; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; @@ -24,6 +25,11 @@ public class Alerts { public static HashMap patterns = new HashMap<>(); public static String configFile; + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmalerts.json"; + } + @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { if (!ToggleCommand.alerts || event.type == 2) return; diff --git a/src/main/java/me/Danker/features/ChatAliases.java b/src/main/java/me/Danker/features/ChatAliases.java index ae9e0f7..76ab5f6 100644 --- a/src/main/java/me/Danker/features/ChatAliases.java +++ b/src/main/java/me/Danker/features/ChatAliases.java @@ -1,6 +1,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; +import me.Danker.events.ModInitEvent; import me.Danker.events.PacketWriteEvent; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C01PacketChatMessage; @@ -16,6 +17,11 @@ public class ChatAliases { public static List aliases = new ArrayList<>(); public static String configFile; + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmaliases.json"; + } + @SubscribeEvent public void onPacketWrite(PacketWriteEvent event) { if (event.packet instanceof C01PacketChatMessage) { diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 8ce8c05..e6f8131 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -2,6 +2,7 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; @@ -13,6 +14,7 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -196,6 +198,11 @@ public class CustomMusic { } } + @SubscribeEvent + public void init(ModInitEvent event) { + init(event.configDirectory); + } + public static void init(String configDirectory) { if (configDirectory == null) return; File directory = new File(configDirectory + "/dsmmusic"); diff --git a/src/main/java/me/Danker/features/GemstonesLore.java b/src/main/java/me/Danker/features/GemstonesLore.java index 7db2d33..b16edaf 100644 --- a/src/main/java/me/Danker/features/GemstonesLore.java +++ b/src/main/java/me/Danker/features/GemstonesLore.java @@ -1,6 +1,7 @@ package me.Danker.features; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; @@ -18,7 +19,8 @@ public class GemstonesLore { static Map gemstoneColours = new HashMap<>(); - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { gemstoneColours.put("Amber", EnumChatFormatting.GOLD); gemstoneColours.put("Sapphire", EnumChatFormatting.AQUA); gemstoneColours.put("Jasper", EnumChatFormatting.LIGHT_PURPLE); diff --git a/src/main/java/me/Danker/features/GoldenEnchants.java b/src/main/java/me/Danker/features/GoldenEnchants.java index d633ec5..228d43e 100644 --- a/src/main/java/me/Danker/features/GoldenEnchants.java +++ b/src/main/java/me/Danker/features/GoldenEnchants.java @@ -1,6 +1,7 @@ package me.Danker.features; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -15,7 +16,8 @@ public class GoldenEnchants { public static Map t6Enchants = new HashMap<>(); public static Pattern t6EnchantPattern = Pattern.compile(""); - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { t6Enchants.put("9Angler VI", "6Angler VI"); t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); t6Enchants.put("9Caster VI", "6Caster VI"); diff --git a/src/main/java/me/Danker/features/MinionLastCollected.java b/src/main/java/me/Danker/features/MinionLastCollected.java index 884dccf..7079f40 100644 --- a/src/main/java/me/Danker/features/MinionLastCollected.java +++ b/src/main/java/me/Danker/features/MinionLastCollected.java @@ -3,6 +3,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; import me.Danker.commands.ToggleCommand; import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.events.ModInitEvent; import me.Danker.events.PacketWriteEvent; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; @@ -28,6 +29,11 @@ public class MinionLastCollected { static BlockPos lastMinion = null; public static int LAST_COLLECTED_COLOUR; + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmminions.json"; + } + @SubscribeEvent public void onPacketWrite(PacketWriteEvent event) { if (ToggleCommand.minionLastCollected && Utils.inSkyblock && Utils.isInScoreboard("Your Island")) { diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 7832362..556108c 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -946,6 +946,82 @@ public class LootDisplay { EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; + case "fishing_trophy": + dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + + EnumChatFormatting.WHITE + "Obfuscated 1:\n" + + EnumChatFormatting.WHITE + "Steaminghot Flounder:\n" + + EnumChatFormatting.WHITE + "Gusher:\n" + + EnumChatFormatting.WHITE + "Blobfish:\n" + + EnumChatFormatting.GREEN + "Obfuscated 2:\n" + + EnumChatFormatting.GREEN + "Slugfish:\n" + + EnumChatFormatting.GREEN + "Flyfish:\n" + + EnumChatFormatting.BLUE + "Obfuscated 3:\n" + + EnumChatFormatting.BLUE + "Lavahorse:\n" + + EnumChatFormatting.BLUE + "Mana Ray:\n" + + EnumChatFormatting.BLUE + "Volcanic Stonefish:\n" + + EnumChatFormatting.BLUE + "Vanille:\n" + + EnumChatFormatting.DARK_PURPLE + "Skeleton Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Moldfin:\n" + + EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + + EnumChatFormatting.GOLD + "Golden Fish:"; + countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish"); + break; + case "fishing_trophy_session": + dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + + EnumChatFormatting.WHITE + "Obfuscated 1:\n" + + EnumChatFormatting.WHITE + "Steaminghot Flounder:\n" + + EnumChatFormatting.WHITE + "Gusher:\n" + + EnumChatFormatting.WHITE + "Blobfish:\n" + + EnumChatFormatting.GREEN + "Obfuscated 2:\n" + + EnumChatFormatting.GREEN + "Slugfish:\n" + + EnumChatFormatting.GREEN + "Flyfish:\n" + + EnumChatFormatting.BLUE + "Obfuscated 3:\n" + + EnumChatFormatting.BLUE + "Lavahorse:\n" + + EnumChatFormatting.BLUE + "Mana Ray:\n" + + EnumChatFormatting.BLUE + "Volcanic Stonefish:\n" + + EnumChatFormatting.BLUE + "Vanille:\n" + + EnumChatFormatting.DARK_PURPLE + "Skeleton Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Moldfin:\n" + + EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + + EnumChatFormatting.GOLD + "Golden Fish:"; + countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish"); + break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + diff --git a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java new file mode 100644 index 0000000..d11fcfe --- /dev/null +++ b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java @@ -0,0 +1,120 @@ +package me.Danker.features.loot; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import me.Danker.events.ModInitEvent; +import me.Danker.utils.Utils; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TrophyFishTracker { + + public static JsonObject fish = new JsonObject(); + public static JsonObject fishSession = new JsonObject(); + public static Pattern fishPattern = Pattern.compile("TROPHY FISH! You caught a (?.*) (?.*)."); + public static String configFile; + + public static JsonObject createEmpty() { + JsonObject fish = new JsonObject(); + + JsonObject tiers = new JsonObject(); + tiers.addProperty("BRONZE", 0); + tiers.addProperty("SILVER", 0); + tiers.addProperty("GOLD", 0); + tiers.addProperty("DIAMOND", 0); + + fish.add("Sulpher Skitter", Utils.deepCopy(tiers)); + fish.add("Obfuscated 1", Utils.deepCopy(tiers)); + fish.add("Steaming-Hot Flounder", Utils.deepCopy(tiers)); + fish.add("Obfuscated 2", Utils.deepCopy(tiers)); + fish.add("Gusher", Utils.deepCopy(tiers)); + fish.add("Blobfish", Utils.deepCopy(tiers)); + fish.add("Slugfish", Utils.deepCopy(tiers)); + fish.add("Obfuscated 3", Utils.deepCopy(tiers)); + fish.add("Flyfish", Utils.deepCopy(tiers)); + fish.add("Lavahorse", Utils.deepCopy(tiers)); + fish.add("Mana Ray", Utils.deepCopy(tiers)); + fish.add("Volcanic Stonefish", Utils.deepCopy(tiers)); + fish.add("Vanille", Utils.deepCopy(tiers)); + fish.add("Skeleton Fish", Utils.deepCopy(tiers)); + fish.add("Moldfin", Utils.deepCopy(tiers)); + fish.add("Soul Fish", Utils.deepCopy(tiers)); + fish.add("Karate Fish", Utils.deepCopy(tiers)); + fish.add("Golden Fish", Utils.deepCopy(tiers)); + + return fish; + } + + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmtrophyfish.json"; + if (fish.entrySet().isEmpty()) fish = createEmpty(); + fishSession = createEmpty(); + } + + @SubscribeEvent(receiveCanceled = true) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (!Utils.tabLocation.equals("Crimson Isle")) return; + if (event.type == 2) return; + if (message.contains(":")) return; + + Matcher matcher = fishPattern.matcher(message); + + if (matcher.matches()) { + String fishName = matcher.group("fish"); + String tier = matcher.group("tier"); + + JsonObject fishObj = fish.get(fishName).getAsJsonObject(); + int amount = fishObj.get(tier).getAsInt(); + fishObj.addProperty(tier, amount + 1); + + JsonObject fishSessionObj = fishSession.get(fishName).getAsJsonObject(); + int amountSession = fishSessionObj.get(tier).getAsInt(); + fishSessionObj.addProperty(tier, amountSession + 1); + + save(); + } + } + + public static void save() { + try (FileWriter writer = new FileWriter(configFile)) { + new GsonBuilder().create().toJson(fish, writer); + writer.flush(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static String getTierCount(JsonObject obj, String name) { + JsonObject type = obj.get(name).getAsJsonObject(); + + int bronze = type.get("BRONZE").getAsInt(); + int silver = type.get("SILVER").getAsInt(); + int gold = type.get("GOLD").getAsInt(); + int diamond = type.get("DIAMOND").getAsInt(); + + return EnumChatFormatting.DARK_GRAY + "" + bronze + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.GRAY + silver + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.GOLD + gold + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.AQUA + diamond; + } + + public static int getSum(JsonObject obj, String name) { + JsonObject type = obj.get(name).getAsJsonObject(); + return type.get("BRONZE").getAsInt() + + type.get("SILVER").getAsInt() + + type.get("GOLD").getAsInt() + + type.get("DIAMOND").getAsInt(); + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index dd2c23e..23d0228 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -5,6 +5,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; @@ -26,7 +27,8 @@ public class TriviaSolver { static JsonArray triviaAnswersJson = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { // Hard coded solutions if api call fails triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); @@ -39,11 +41,12 @@ public class TriviaSolver { triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"227 Fairy Souls"}); + triviaSolutions.put("What is the status of Maxor, Storm, Goldor and Necron?", new String[]{"Wither Lord"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"238 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Crimson Isle?", new String[]{"29 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); @@ -57,7 +60,7 @@ public class TriviaSolver { triviaSolutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); triviaSolutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); - triviaSolutions.put("How many unique minions are there?", new String[]{"53 Minions"}); + triviaSolutions.put("How many unique minions are there?", new String[]{"55 Minions"}); triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", "Dashing Spooder", "Broodfather", "Night Spider"}); triviaSolutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index b8be3d6..2afa187 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -5,6 +5,7 @@ import me.Danker.handlers.ConfigHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -28,6 +29,7 @@ public class DisplayGui extends GuiScreen { private GuiButton fishingSpooky; private GuiButton fishingCH; private GuiButton fishingLava; + private GuiButton fishingTrophy; private GuiButton catacombsF1; private GuiButton catacombsF2; private GuiButton catacombsF3; @@ -61,12 +63,13 @@ public class DisplayGui extends GuiScreen { wolf = new GuiButton(0, width / 2 - 50, (int) (height * 0.35), 100, 20, "Wolf"); enderman = new GuiButton(0, width / 2 + 60, (int) (height * 0.35), 100, 20, "Enderman"); blaze = new GuiButton(0, width / 2 + 170, (int) (height * 0.35), 100, 20, "Blaze"); - fishing = new GuiButton(0, width / 2 - 295, (int) (height * 0.5), 90, 20, "Fishing"); - fishingWinter = new GuiButton(0, width / 2 - 195, (int) (height * 0.5), 90, 20, "Fishing Winter"); - fishingFestival = new GuiButton(0, width / 2 - 95, (int) (height * 0.5), 90, 20, "Fishing Festival"); - fishingSpooky = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 90, 20, "Fishing Spooky"); - fishingCH = new GuiButton(0, width / 2 + 105, (int) (height * 0.5), 90, 20, "CH Fishing"); - fishingLava = new GuiButton(0, width / 2 + 205, (int) (height * 0.5), 90, 20, "Lava Fishing"); + fishing = new GuiButton(0, width / 2 - 310, (int) (height * 0.5), 80, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 220, (int) (height * 0.5), 80, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 - 130, (int) (height * 0.5), 80, 20, "Fishing Festival"); + fishingSpooky = new GuiButton(0, width / 2 - 40, (int) (height * 0.5), 80, 20, "Fishing Spooky"); + fishingCH = new GuiButton(0, width / 2 + 50, (int) (height * 0.5), 80, 20, "CH Fishing"); + fishingLava = new GuiButton(0, width / 2 + 140, (int) (height * 0.5), 80, 20, "Lava Fishing"); + fishingTrophy = new GuiButton(0, width / 2 + 230, (int) (height * 0.5), 80, 20, "Fishing Trophy"); catacombsF1 = new GuiButton(0, width / 2 - 235, (int) (height * 0.65), 50, 20, "F1"); catacombsF2 = new GuiButton(0, width / 2 - 175, (int) (height * 0.65), 50, 20, "F2"); catacombsF3 = new GuiButton(0, width / 2 - 115, (int) (height * 0.65), 50, 20, "F3"); @@ -92,6 +95,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(fishingSpooky); this.buttonList.add(fishingCH); this.buttonList.add(fishingLava); + this.buttonList.add(fishingTrophy); this.buttonList.add(catacombsF1); this.buttonList.add(catacombsF2); this.buttonList.add(catacombsF3); @@ -153,6 +157,8 @@ public class DisplayGui extends GuiScreen { setDisplay("fishing_ch"); } else if (button == fishingLava) { setDisplay("fishing_lava"); + } else if (button == fishingTrophy) { + setDisplay("fishing_trophy"); } else if (button == mythological) { setDisplay("mythological"); } else if (button == catacombsF1) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index bd60639..b2c51a4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,7 +1,6 @@ package me.Danker.handlers; -import com.google.gson.Gson; -import com.google.gson.JsonArray; +import com.google.gson.*; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -750,6 +749,14 @@ public class ConfigHandler { } MinionLastCollected.Minion[] minions = gson.fromJson(new FileReader(MinionLastCollected.configFile), MinionLastCollected.Minion[].class); if (minions != null) MinionLastCollected.minions = new ArrayList<>(Arrays.asList(minions)); + + // Trophy Fish + if (!(new File(TrophyFishTracker.configFile).exists())) { + FileWriter file = new FileWriter(TrophyFishTracker.configFile); + file.write(new JsonObject().toString()); + file.close(); + } + TrophyFishTracker.fish = new JsonParser().parse(new FileReader(TrophyFishTracker.configFile)).getAsJsonObject(); } catch (IOException ex) { ex.printStackTrace(); } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 3cef436..094690e 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,5 +1,7 @@ package me.Danker.utils; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.ColouredNames; import me.Danker.features.GoldenEnchants; @@ -509,6 +511,16 @@ public class Utils { } } + public static JsonObject deepCopy(JsonObject obj) { + JsonObject newObj = new JsonObject(); + + for (Map.Entry entry : obj.entrySet()) { + newObj.add(entry.getKey(), entry.getValue()); + } + + return newObj; + } + public enum DungeonFloor { NONE, E0, -- cgit From 66fa83a1942b4ec79c5fa94168c04b84c60c628a Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 6 Aug 2022 22:08:32 -0400 Subject: Add trophy fish completion to display --- .../java/me/Danker/commands/ToggleCommand.java | 1 + src/main/java/me/Danker/features/Alerts.java | 1 - .../me/Danker/features/CrystalHollowWaypoints.java | 1 - src/main/java/me/Danker/features/CustomMusic.java | 1 - .../java/me/Danker/features/loot/LootDisplay.java | 46 +++++++++++++++++++++- .../me/Danker/features/loot/TrophyFishTracker.java | 23 +++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 7 ++++ src/main/java/me/Danker/gui/DisplayGui.java | 1 - .../java/me/Danker/gui/alerts/AlertActionGui.java | 1 - .../java/me/Danker/handlers/ConfigHandler.java | 6 ++- src/main/java/me/Danker/utils/RenderUtils.java | 9 +++-- src/main/java/me/Danker/utils/Utils.java | 2 +- 12 files changed, 86 insertions(+), 13 deletions(-) (limited to 'src/main/java/me/Danker/gui/DisplayGui.java') diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index c08d50a..3c353c8 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -65,6 +65,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean aliases; public static boolean fishingAlert; public static boolean minionLastCollected; + public static boolean showTrophyCompletion; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; diff --git a/src/main/java/me/Danker/features/Alerts.java b/src/main/java/me/Danker/features/Alerts.java index e54a212..aa6197f 100644 --- a/src/main/java/me/Danker/features/Alerts.java +++ b/src/main/java/me/Danker/features/Alerts.java @@ -1,7 +1,6 @@ package me.Danker.features; import com.google.gson.GsonBuilder; -import javafx.scene.control.Alert; import me.Danker.commands.ToggleCommand; import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java index 39a71b4..12aa94e 100644 --- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -7,7 +7,6 @@ import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index e6f8131..32af6c9 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -14,7 +14,6 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 556108c..fe68c3e 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -965,7 +965,7 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + EnumChatFormatting.GOLD + "Golden Fish:"; - countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + if (!ToggleCommand.showTrophyCompletion) countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + @@ -983,6 +983,27 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish"); + + if (ToggleCommand.showTrophyCompletion) { + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Sulpher Skitter", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 1", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Steaming-Hot Flounder", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (2 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Gusher", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (3 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Blobfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (4 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 2", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (5 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Slugfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (6 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Flyfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (7 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 3", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (8 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Lavahorse", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (9 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Mana Ray", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (10 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Volcanic Stonefish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (11 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Vanille", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (12 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Skeleton Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (13 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Moldfin", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (14 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Soul Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (15 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Karate Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (16 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Golden Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (17 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + } break; case "fishing_trophy_session": dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + @@ -1003,7 +1024,7 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + EnumChatFormatting.GOLD + "Golden Fish:"; - countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + if (!ToggleCommand.showTrophyCompletion) countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + @@ -1021,6 +1042,27 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish"); + + if (ToggleCommand.showTrophyCompletion) { + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Sulpher Skitter", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 1", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Steaming-Hot Flounder", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (2 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Gusher", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (3 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Blobfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (4 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 2", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (5 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Slugfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (6 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Flyfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (7 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 3", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (8 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Lavahorse", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (9 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Mana Ray", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (10 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Volcanic Stonefish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (11 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Vanille", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (12 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Skeleton Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (13 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Moldfin", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (14 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Soul Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (15 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Karate Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (16 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Golden Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (17 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + } break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + diff --git a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java index d11fcfe..6202871 100644 --- a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java +++ b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java @@ -3,7 +3,10 @@ package me.Danker.features.loot; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import me.Danker.events.ModInitEvent; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -117,4 +120,24 @@ public class TrophyFishTracker { type.get("DIAMOND").getAsInt(); } + public static void drawCompletion(JsonObject obj, String name, int x, int y, double scale) { + JsonObject type = obj.get(name).getAsJsonObject(); + + boolean bronze = type.get("BRONZE").getAsInt() > 0; + boolean silver = type.get("SILVER").getAsInt() > 0; + boolean gold = type.get("GOLD").getAsInt() > 0; + boolean diamond = type.get("DIAMOND").getAsInt() > 0; + + ItemStack incomplete = new ItemStack(Items.dye, 1, 8); + ItemStack bronzeComplete = new ItemStack(Items.brick); + ItemStack silverComplete = new ItemStack(Items.iron_ingot); + ItemStack goldComplete = new ItemStack(Items.gold_ingot); + ItemStack diamondComplete = new ItemStack(Items.diamond); + + RenderUtils.renderItem(bronze ? bronzeComplete : incomplete, x, y - 2, scale / 1.3D); + RenderUtils.renderItem(silver ? silverComplete : incomplete, x + 15, y - 2, scale / 1.3D); + RenderUtils.renderItem(gold ? goldComplete : incomplete, x + 30, y - 2, scale / 1.3D); + RenderUtils.renderItem(diamond ? diamondComplete : incomplete, x + 45, y - 2, scale / 1.3D); + } + } diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index c247eab..cab2b5c 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -93,6 +93,7 @@ public class DankerGui extends GuiScreen { private GuiButton firePillar; private GuiButton fishingAlert; private GuiButton minionLastCollected; + private GuiButton showTrophyCompletion; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -190,6 +191,7 @@ public class DankerGui extends GuiScreen { firePillar = new FeatureButton("Fire Pillar Display: " + Utils.getColouredBoolean(ToggleCommand.firePillar), "Displays blaze fire pillar text on screen"); fishingAlert = new FeatureButton("Fishing Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.fishingAlert), "Alerts when a Thunder or Lord Jawbus spawns nearby"); minionLastCollected = new FeatureButton("Show When Minion Last Collected: " + Utils.getColouredBoolean(ToggleCommand.minionLastCollected), "Displays when a minion was last collected over the minion."); + showTrophyCompletion = new FeatureButton("Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion), "Show completion instead of count in trophy fish tracker display."); allButtons.clear(); allButtons.add(changeDisplay); @@ -253,6 +255,7 @@ public class DankerGui extends GuiScreen { allButtons.add(firePillar); allButtons.add(fishingAlert); allButtons.add(minionLastCollected); + allButtons.add(showTrophyCompletion); search.setText(initSearchText); search.setVisible(true); @@ -558,6 +561,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.minionLastCollected = !ToggleCommand.minionLastCollected; ConfigHandler.writeBooleanConfig("toggles", "MinionLastCollected", ToggleCommand.minionLastCollected); minionLastCollected.displayString = "Show When Minion Last Collected: " + Utils.getColouredBoolean(ToggleCommand.minionLastCollected); + } else if (button == showTrophyCompletion) { + ToggleCommand.showTrophyCompletion = !ToggleCommand.showTrophyCompletion; + ConfigHandler.writeBooleanConfig("toggles", "ShowTrophyCompletion", ToggleCommand.showTrophyCompletion); + showTrophyCompletion.displayString = "Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion); } } diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 2afa187..f7fd2f3 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -5,7 +5,6 @@ import me.Danker.handlers.ConfigHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; diff --git a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java index 4853ac1..02c3d3b 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java @@ -1,7 +1,6 @@ package me.Danker.gui.alerts; import me.Danker.features.Alerts; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index b2c51a4..484a7d5 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,6 +1,9 @@ package me.Danker.handlers; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -249,6 +252,7 @@ public class ConfigHandler { ToggleCommand.aliases = initBoolean("toggles", "Aliases", false); ToggleCommand.fishingAlert = initBoolean("toggles", "FishingAlert", false); ToggleCommand.minionLastCollected = initBoolean("toggles", "MinionLastCollected", false); + ToggleCommand.showTrophyCompletion = initBoolean("toggles", "ShowTrophyCompletion", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index c3efc90..f334b7a 100644 --- a/src/main/java/me/Danker/utils/RenderUtils.java +++ b/src/main/java/me/Danker/utils/RenderUtils.java @@ -387,15 +387,16 @@ public class RenderUtils { GlStateManager.popMatrix(); } - public static void renderItem(ItemStack item, float x, float y, float z) { - + public static void renderItem(ItemStack stack, int x, int y, double scale) { GlStateManager.enableRescaleNormal(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableDepth(); GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, z); - Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(item, 0, 0); + GlStateManager.translate(x, y, 0); + GlStateManager.scale(scale, scale, scale); + //Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(stack, 0, 0); + Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); GlStateManager.popMatrix(); GlStateManager.disableDepth(); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 094690e..4aa094d 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -22,8 +22,8 @@ import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.*; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -- cgit