From ad53066846fb168255499a332a1ad4bca39f5935 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 27 Feb 2021 18:25:51 -0500 Subject: Move features into their own files --- src/main/java/me/Danker/features/AutoDisplay.java | 73 ++ .../me/Danker/features/AutoSwapToPickBlock.java | 51 + .../java/me/Danker/features/BlockWrongSlayer.java | 42 + .../java/me/Danker/features/BonzoMaskTimer.java | 86 ++ src/main/java/me/Danker/features/CakeTimer.java | 62 ++ src/main/java/me/Danker/features/DungeonTimer.java | 79 ++ .../java/me/Danker/features/ExpertiseLore.java | 40 + .../me/Danker/features/FasterMaddoxCalling.java | 64 ++ .../java/me/Danker/features/GoldenEnchants.java | 68 ++ .../me/Danker/features/GolemSpawningAlert.java | 26 + .../me/Danker/features/GpartyNotifications.java | 38 + .../Danker/features/HideTooltipsInExperiments.java | 35 + .../me/Danker/features/LowHealthNotifications.java | 36 + .../me/Danker/features/NecronNotifications.java | 78 ++ src/main/java/me/Danker/features/NoF3Coords.java | 33 + .../java/me/Danker/features/NotifySlayerSlain.java | 88 ++ src/main/java/me/Danker/features/PetColours.java | 69 ++ src/main/java/me/Danker/features/Reparty.java | 143 +++ .../java/me/Danker/features/Skill50Display.java | 77 ++ src/main/java/me/Danker/features/SkillTracker.java | 208 ++++ src/main/java/me/Danker/features/SpamHider.java | 51 + .../java/me/Danker/features/SpiritBearAlert.java | 24 + .../Danker/features/StopSalvagingStarredItems.java | 34 + .../java/me/Danker/features/UpdateChecker.java | 52 + .../java/me/Danker/features/WatcherReadyAlert.java | 22 + .../java/me/Danker/features/loot/LootDisplay.java | 903 ++++++++++++++++ .../java/me/Danker/features/loot/LootTracker.java | 1097 ++++++++++++++++++++ .../puzzlesolvers/ArrowTerminalSolver.java | 32 + .../Danker/features/puzzlesolvers/BlazeSolver.java | 86 ++ .../features/puzzlesolvers/BlockAbilities.java | 84 ++ .../puzzlesolvers/BlockPlacingFlowers.java | 44 + .../puzzlesolvers/BlockWrongTerminalClicks.java | 112 ++ .../features/puzzlesolvers/ChronomatronSolver.java | 114 ++ .../features/puzzlesolvers/ClickInOrderSolver.java | 107 ++ .../features/puzzlesolvers/CreeperSolver.java | 86 ++ .../Danker/features/puzzlesolvers/LividSolver.java | 89 ++ .../puzzlesolvers/SelectAllColourSolver.java | 59 ++ .../features/puzzlesolvers/StartsWithSolver.java | 31 + .../features/puzzlesolvers/SuperpairsSolver.java | 150 +++ .../features/puzzlesolvers/ThreeManSolver.java | 75 ++ .../features/puzzlesolvers/TicTacToeSolver.java | 135 +++ .../features/puzzlesolvers/TriviaSolver.java | 105 ++ .../puzzlesolvers/UltrasequencerSolver.java | 112 ++ .../Danker/features/puzzlesolvers/WaterSolver.java | 162 +++ 44 files changed, 5162 insertions(+) create mode 100644 src/main/java/me/Danker/features/AutoDisplay.java create mode 100644 src/main/java/me/Danker/features/AutoSwapToPickBlock.java create mode 100644 src/main/java/me/Danker/features/BlockWrongSlayer.java create mode 100644 src/main/java/me/Danker/features/BonzoMaskTimer.java create mode 100644 src/main/java/me/Danker/features/CakeTimer.java create mode 100644 src/main/java/me/Danker/features/DungeonTimer.java create mode 100644 src/main/java/me/Danker/features/ExpertiseLore.java create mode 100644 src/main/java/me/Danker/features/FasterMaddoxCalling.java create mode 100644 src/main/java/me/Danker/features/GoldenEnchants.java create mode 100644 src/main/java/me/Danker/features/GolemSpawningAlert.java create mode 100644 src/main/java/me/Danker/features/GpartyNotifications.java create mode 100644 src/main/java/me/Danker/features/HideTooltipsInExperiments.java create mode 100644 src/main/java/me/Danker/features/LowHealthNotifications.java create mode 100644 src/main/java/me/Danker/features/NecronNotifications.java create mode 100644 src/main/java/me/Danker/features/NoF3Coords.java create mode 100644 src/main/java/me/Danker/features/NotifySlayerSlain.java create mode 100644 src/main/java/me/Danker/features/PetColours.java create mode 100644 src/main/java/me/Danker/features/Reparty.java create mode 100644 src/main/java/me/Danker/features/Skill50Display.java create mode 100644 src/main/java/me/Danker/features/SkillTracker.java create mode 100644 src/main/java/me/Danker/features/SpamHider.java create mode 100644 src/main/java/me/Danker/features/SpiritBearAlert.java create mode 100644 src/main/java/me/Danker/features/StopSalvagingStarredItems.java create mode 100644 src/main/java/me/Danker/features/UpdateChecker.java create mode 100644 src/main/java/me/Danker/features/WatcherReadyAlert.java create mode 100644 src/main/java/me/Danker/features/loot/LootDisplay.java create mode 100644 src/main/java/me/Danker/features/loot/LootTracker.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/ChronomatronSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/ClickInOrderSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/SelectAllColourSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/SuperpairsSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/TicTacToeSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/WaterSolver.java (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java new file mode 100644 index 0000000..aaed4ca --- /dev/null +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -0,0 +1,73 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.DisplayCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.ScoreboardHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class AutoDisplay { + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + World world = mc.theWorld; + EntityPlayerSP player = mc.thePlayer; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (DisplayCommand.auto && world != null && player != null) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + boolean found = false; + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("Sven Packmaster")) { + DisplayCommand.display = "wolf"; + found = true; + } else if (sCleaned.contains("Tarantula Broodfather")) { + DisplayCommand.display = "spider"; + found = true; + } else if (sCleaned.contains("Revenant Horror")) { + DisplayCommand.display = "zombie"; + found = true; + } else if (sCleaned.contains("The Catacombs (")) { + if (sCleaned.contains("F1")) { + DisplayCommand.display = "catacombs_floor_one"; + } else if (sCleaned.contains("F2")) { + DisplayCommand.display = "catacombs_floor_two"; + } else if (sCleaned.contains("F3")) { + DisplayCommand.display = "catacombs_floor_three"; + } else if (sCleaned.contains("F4")) { + DisplayCommand.display = "catacombs_floor_four"; + } else if (sCleaned.contains("F5")) { + DisplayCommand.display = "catacombs_floor_five"; + } else if (sCleaned.contains("F6")) { + DisplayCommand.display = "catacombs_floor_six"; + } else if (sCleaned.contains("F7")) { + DisplayCommand.display = "catacombs_floor_seven"; + } + found = true; + } + } + for (int i = 0; i < 8; i++) { + ItemStack hotbarItem = player.inventory.getStackInSlot(i); + if (hotbarItem == null) continue; + if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { + DisplayCommand.display = "mythological"; + found = true; + } + } + if (!found) DisplayCommand.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/AutoSwapToPickBlock.java b/src/main/java/me/Danker/features/AutoSwapToPickBlock.java new file mode 100644 index 0000000..ccabbce --- /dev/null +++ b/src/main/java/me/Danker/features/AutoSwapToPickBlock.java @@ -0,0 +1,51 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class AutoSwapToPickBlock { + + static int pickBlockBind; + static boolean pickBlockBindSwapped = false; + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + GameSettings gameSettings = mc.gameSettings; + if (event.gui instanceof GuiChest) { + Container containerChest = ((GuiChest) event.gui).inventorySlots; + if (containerChest instanceof ContainerChest) { + IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); + String inventoryName = inventory.getDisplayName().getUnformattedText(); + + if (ToggleCommand.swapToPickBlockToggled) { + if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (") || inventoryName.startsWith("What starts with:") || inventoryName.startsWith("Select all the") || inventoryName.startsWith("Navigate the maze!") || inventoryName.startsWith("Correct all the panes!") || inventoryName.startsWith("Click in order!") || inventoryName.startsWith("Harp -")) { + if (!pickBlockBindSwapped) { + pickBlockBind = gameSettings.keyBindPickBlock.getKeyCode(); + gameSettings.keyBindPickBlock.setKeyCode(-100); + pickBlockBindSwapped = true; + } + } else { + if (pickBlockBindSwapped) { + gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind); + pickBlockBindSwapped = false; + } + } + } + } + } else { + if (pickBlockBindSwapped) { + gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind); + pickBlockBindSwapped = false; + } + } + } + +} diff --git a/src/main/java/me/Danker/features/BlockWrongSlayer.java b/src/main/java/me/Danker/features/BlockWrongSlayer.java new file mode 100644 index 0000000..6da4798 --- /dev/null +++ b/src/main/java/me/Danker/features/BlockWrongSlayer.java @@ -0,0 +1,42 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.events.ChestSlotClickedEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class BlockWrongSlayer { + + public static String onlySlayerName = ""; + public static String onlySlayerNumber = ""; + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + String inventoryName = event.inventoryName; + ItemStack item = event.item; + if (!onlySlayerName.equals("") && item != null) { + if (inventoryName.equals("Slayer")) { + if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster")) + return; + if (!item.getDisplayName().contains(onlySlayerName)) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + onlySlayerName + " " + onlySlayerNumber + ")")); + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5); + event.setCanceled(true); + } + } else if (inventoryName.equals("Revenant Horror") || inventoryName.equals("Tarantula Broodfather") || inventoryName.equals("Sven Packmaster")) { + if (item.getDisplayName().contains("Revenant Horror") || item.getDisplayName().contains("Tarantula Broodfather") || item.getDisplayName().contains("Sven Packmaster")) { + // Only check number as they passed the above check + String slayerNumber = item.getDisplayName().substring(item.getDisplayName().lastIndexOf(" ") + 1); + if (!slayerNumber.equals(onlySlayerNumber)) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + onlySlayerName + " " + onlySlayerNumber + ")")); + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5); + event.setCanceled(true); + } + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/BonzoMaskTimer.java b/src/main/java/me/Danker/features/BonzoMaskTimer.java new file mode 100644 index 0000000..e038786 --- /dev/null +++ b/src/main/java/me/Danker/features/BonzoMaskTimer.java @@ -0,0 +1,86 @@ +package me.Danker.features; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +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.Gui; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; + +public class BonzoMaskTimer { + + public static double nextBonzoUse = 0; + public static String BONZO_COLOR; + public static final ResourceLocation BONZO_ICON = new ResourceLocation("dsm", "icons/bonzo.png"); + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + nextBonzoUse = 0; + } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inDungeons) return; + + if (ToggleCommand.bonzoTimerToggled && message.contains("Bonzo's Mask") && message.contains("saved your life!")) { + double usedTime = System.currentTimeMillis() / 1000; + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + ItemStack bonzoMask = player.getCurrentArmor(3); + if (bonzoMask != null && bonzoMask.getItem() == Items.skull) { + int cooldownSeconds = 0; + for (String line : Utils.getItemLore(bonzoMask)) { + String stripped = StringUtils.stripControlCodes(line); + if (stripped.startsWith("Cooldown: ")) + cooldownSeconds = Integer.parseInt(stripped.replaceAll("[^\\d]", "")); + } + System.out.println("Parsed Bonzo Mask Cooldown: " + cooldownSeconds); + if (cooldownSeconds > 0) + nextBonzoUse = usedTime + cooldownSeconds; + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.bonzoTimerToggled && Utils.inDungeons) { + Minecraft mc = Minecraft.getMinecraft(); + ItemStack helmetSlot = mc.thePlayer.getCurrentArmor(3); + if ((helmetSlot != null && helmetSlot.getDisplayName().contains("Bonzo's Mask")) || nextBonzoUse > 0) { + + double scale = ScaleCommand.bonzoTimerScale; + double scaleReset = Math.pow(scale, -1); + GL11.glScaled(scale, scale, scale); + + double timeNow = System.currentTimeMillis() / 1000; + mc.getTextureManager().bindTexture(BONZO_ICON); + Gui.drawModalRectWithCustomSizedTexture(MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1], 0, 0, 16, 16, 16, 16); + + String bonzoText; + if (nextBonzoUse - timeNow < 0) { + bonzoText = EnumChatFormatting.GREEN + "READY"; + } else { + bonzoText = BONZO_COLOR + Utils.getTimeBetween(timeNow, nextBonzoUse); + } + new TextRenderer(mc, bonzoText, MoveCommand.bonzoTimerXY[0] + 20, MoveCommand.bonzoTimerXY[1] + 5, 1); + + GL11.glScaled(scaleReset, scaleReset, scaleReset); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/CakeTimer.java b/src/main/java/me/Danker/features/CakeTimer.java new file mode 100644 index 0000000..ba6eb3d --- /dev/null +++ b/src/main/java/me/Danker/features/CakeTimer.java @@ -0,0 +1,62 @@ +package me.Danker.features; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +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.Gui; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; + +public class CakeTimer { + + public static double cakeTime; + public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); + public static String CAKE_COLOUR; + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (message.contains(":")) return; + + if (message.contains("Yum! You gain +") && message.contains(" for 48 hours!")) { + cakeTime = System.currentTimeMillis() / 1000 + 172800; // Add 48 hours + ConfigHandler.writeDoubleConfig("misc", "cakeTime", cakeTime); + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.cakeTimerToggled && Utils.inSkyblock) { + Minecraft mc = Minecraft.getMinecraft(); + double scale = ScaleCommand.cakeTimerScale; + double scaleReset = Math.pow(scale, -1); + GL11.glScaled(scale, scale, scale); + + double timeNow = System.currentTimeMillis() / 1000; + mc.getTextureManager().bindTexture(CAKE_ICON); + Gui.drawModalRectWithCustomSizedTexture(MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1], 0, 0, 16, 16, 16, 16); + + String cakeText; + if (cakeTime - timeNow < 0) { + cakeText = EnumChatFormatting.RED + "NONE"; + } else { + cakeText = CAKE_COLOUR + Utils.getTimeBetween(timeNow, cakeTime); + } + new TextRenderer(mc, cakeText, MoveCommand.cakeTimerXY[0] + 20, MoveCommand.cakeTimerXY[1] + 5, 1); + + GL11.glScaled(scaleReset, scaleReset, scaleReset); + } + } + +} diff --git a/src/main/java/me/Danker/features/DungeonTimer.java b/src/main/java/me/Danker/features/DungeonTimer.java new file mode 100644 index 0000000..5929f05 --- /dev/null +++ b/src/main/java/me/Danker/features/DungeonTimer.java @@ -0,0 +1,79 @@ +package me.Danker.features; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +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 DungeonTimer { + + static double dungeonStartTime = 0; + static double bloodOpenTime = 0; + static double watcherClearTime = 0; + static double bossClearTime = 0; + static int witherDoors = 0; + static int dungeonDeaths = 0; + static int puzzleFails = 0; + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inDungeons) return; + + if (message.contains("[BOSS] The Watcher: You have proven yourself. You may pass.")) { + watcherClearTime = System.currentTimeMillis() / 1000; + } else if (message.contains("PUZZLE FAIL! ") || message.contains("chose the wrong answer! I shall never forget this moment")) { + puzzleFails++; + } + + if (message.contains(":")) return; + + if (message.contains("Dungeon starts in 1 second.")) { // Dungeons Stuff + dungeonStartTime = System.currentTimeMillis() / 1000 + 1; + bloodOpenTime = dungeonStartTime; + watcherClearTime = dungeonStartTime; + bossClearTime = dungeonStartTime; + witherDoors = 0; + dungeonDeaths = 0; + puzzleFails = 0; + } else if (message.contains("The BLOOD DOOR has been opened!")) { + bloodOpenTime = System.currentTimeMillis() / 1000; + } else if (message.contains(" opened a WITHER door!")) { + witherDoors++; + } else if (message.contains(" and became a ghost.")) { + dungeonDeaths++; + } else if (message.contains(" Defeated ") && message.contains(" in ")) { + bossClearTime = System.currentTimeMillis() / 1000; + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.dungeonTimerToggled && Utils.inDungeons) { + Minecraft mc = Minecraft.getMinecraft(); + String dungeonTimerText = EnumChatFormatting.GRAY + "Wither Doors:\n" + + EnumChatFormatting.DARK_RED + "Blood Open:\n" + + EnumChatFormatting.RED + "Watcher Clear:\n" + + EnumChatFormatting.BLUE + "Boss Clear:\n" + + EnumChatFormatting.YELLOW + "Deaths:\n" + + EnumChatFormatting.YELLOW + "Puzzle Fails:"; + String dungeonTimers = EnumChatFormatting.GRAY + "" + witherDoors + "\n" + + EnumChatFormatting.DARK_RED + Utils.getTimeBetween(dungeonStartTime, bloodOpenTime) + "\n" + + EnumChatFormatting.RED + Utils.getTimeBetween(dungeonStartTime, watcherClearTime) + "\n" + + EnumChatFormatting.BLUE + Utils.getTimeBetween(dungeonStartTime, bossClearTime) + "\n" + + EnumChatFormatting.YELLOW + dungeonDeaths + "\n" + + EnumChatFormatting.YELLOW + puzzleFails; + new TextRenderer(mc, dungeonTimerText, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + new TextRenderer(mc, dungeonTimers, (int) (MoveCommand.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + } + } + +} diff --git a/src/main/java/me/Danker/features/ExpertiseLore.java b/src/main/java/me/Danker/features/ExpertiseLore.java new file mode 100644 index 0000000..1eb998d --- /dev/null +++ b/src/main/java/me/Danker/features/ExpertiseLore.java @@ -0,0 +1,40 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class ExpertiseLore { + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + ItemStack item = event.itemStack; + if (ToggleCommand.expertiseLoreToggled) { + if (item.hasTagCompound()) { + NBTTagCompound tags = item.getSubCompound("ExtraAttributes", false); + if (tags != null) { + if (tags.hasKey("expertise_kills")) { + int index = 4; + if (!Minecraft.getMinecraft().gameSettings.advancedItemTooltips) index -= 2; + + event.toolTip.add(event.toolTip.size() - index, ""); + event.toolTip.add(event.toolTip.size() - index, "Expertise Kills: " + EnumChatFormatting.RED + tags.getInteger("expertise_kills")); + if (Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) != -1) { + event.toolTip.add(event.toolTip.size() - index, Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) + " kills to tier up!"); + } + } + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/FasterMaddoxCalling.java b/src/main/java/me/Danker/features/FasterMaddoxCalling.java new file mode 100644 index 0000000..fa8bcb5 --- /dev/null +++ b/src/main/java/me/Danker/features/FasterMaddoxCalling.java @@ -0,0 +1,64 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import org.lwjgl.input.Mouse; + +import java.util.List; + +public class FasterMaddoxCalling { + + static String lastMaddoxCommand = "/cb placeholder"; + static double lastMaddoxTime = 0; + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (message.contains(":")) return; + + if (message.contains("[OPEN MENU]")) { + List listOfSiblings = event.message.getSiblings(); + for (IChatComponent sibling : listOfSiblings) { + if (sibling.getUnformattedText().contains("[OPEN MENU]")) { + lastMaddoxCommand = sibling.getChatStyle().getChatClickEvent().getValue(); + lastMaddoxTime = System.currentTimeMillis() / 1000; + } + } + if (ToggleCommand.chatMaddoxToggled) Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Open chat then click anywhere on-screen to open Maddox")); + } + } + + @SubscribeEvent + public void onMouseInputPost(GuiScreenEvent.MouseInputEvent.Post event) { + if (!Utils.inSkyblock) return; + if (Mouse.getEventButton() == 0 && event.gui instanceof GuiChat) { + if (ToggleCommand.chatMaddoxToggled && System.currentTimeMillis() / 1000 - lastMaddoxTime < 10) { + Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + } + } + } + + @SubscribeEvent + public void onKey(InputEvent.KeyInputEvent event) { + if (!Utils.inSkyblock) return; + + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (DankersSkyblockMod.keyBindings[0].isPressed()) { + player.sendChatMessage(lastMaddoxCommand); + } + } + +} diff --git a/src/main/java/me/Danker/features/GoldenEnchants.java b/src/main/java/me/Danker/features/GoldenEnchants.java new file mode 100644 index 0000000..d633ec5 --- /dev/null +++ b/src/main/java/me/Danker/features/GoldenEnchants.java @@ -0,0 +1,68 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +public class GoldenEnchants { + + public static Map t6Enchants = new HashMap<>(); + public static Pattern t6EnchantPattern = Pattern.compile(""); + + public static void init() { + t6Enchants.put("9Angler VI", "6Angler VI"); + t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); + t6Enchants.put("9Caster VI", "6Caster VI"); + t6Enchants.put("9Compact X", "6Compact X"); + t6Enchants.put("9Critical VI", "6Critical VI"); + t6Enchants.put("9Dragon Hunter V", "6Dragon Hunter V"); + t6Enchants.put("9Efficiency VI", "6Efficiency VI"); + t6Enchants.put("9Ender Slayer VI", "6Ender Slayer VI"); + t6Enchants.put("9Experience IV", "6Experience IV"); + t6Enchants.put("9Expertise X", "6Expertise X"); + t6Enchants.put("9Feather Falling X", "6Feather Falling X"); + t6Enchants.put("9Frail VI", "6Frail VI"); + t6Enchants.put("9Giant Killer VI", "6Giant Killer VI"); + t6Enchants.put("9Growth VI", "6Growth VI"); + t6Enchants.put("9Infinite Quiver X", "6Infinite Quiver X"); + t6Enchants.put("9Lethality VI", "6Lethality VI"); + t6Enchants.put("9Life Steal IV", "6Life Steal IV"); + t6Enchants.put("9Looting IV", "6Looting IV"); + t6Enchants.put("9Luck VI", "6Luck VI"); + t6Enchants.put("9Luck of the Sea VI", "6Luck of the Sea VI"); + t6Enchants.put("9Lure VI", "6Lure VI"); + t6Enchants.put("9Magnet VI", "6Magnet VI"); + t6Enchants.put("9Overload V", "6Overload V"); + t6Enchants.put("9Power VI", "6Power VI"); + t6Enchants.put("9Protection VI", "6Protection VI"); + t6Enchants.put("9Scavenger IV", "6Scavenger IV"); + t6Enchants.put("9Scavenger V", "6Scavenger V"); + t6Enchants.put("9Sharpness VI", "6Sharpness VI"); + t6Enchants.put("9Smite VI", "6Smite VI"); + t6Enchants.put("9Spiked Hook VI", "6Spiked Hook VI"); + t6Enchants.put("9Thunderlord VI", "6Thunderlord VI"); + t6Enchants.put("9Vampirism VI", "6Vampirism VI"); + + String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; + t6EnchantPattern = Pattern.compile(patternString); + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + if (ToggleCommand.goldenToggled) { + for (int i = 0; i < event.toolTip.size(); i++) { + event.toolTip.set(i, Utils.returnGoldenEnchants(event.toolTip.get(i))); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/GolemSpawningAlert.java b/src/main/java/me/Danker/features/GolemSpawningAlert.java new file mode 100644 index 0000000..91b647e --- /dev/null +++ b/src/main/java/me/Danker/features/GolemSpawningAlert.java @@ -0,0 +1,26 @@ +package me.Danker.features; + +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; + +public class GolemSpawningAlert { + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (message.contains(":")) return; + + if (ToggleCommand.golemAlertToggled) { + if (message.contains("The ground begins to shake as an Endstone Protector rises from below!")) { + Utils.createTitle(EnumChatFormatting.RED + "GOLEM SPAWNING!", 3); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/GpartyNotifications.java b/src/main/java/me/Danker/features/GpartyNotifications.java new file mode 100644 index 0000000..f3aec69 --- /dev/null +++ b/src/main/java/me/Danker/features/GpartyNotifications.java @@ -0,0 +1,38 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.awt.*; + +public class GpartyNotifications { + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (message.contains(":")) return; + + if (ToggleCommand.gpartyToggled) { + if (message.contains(" has invited all members of ")) { + try { + final SystemTray tray = SystemTray.getSystemTray(); + final Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); + final TrayIcon trayIcon = new TrayIcon(image, "Guild Party Notifier"); + trayIcon.setImageAutoSize(true); + trayIcon.setToolTip("Guild Party Notifier"); + tray.add(trayIcon); + trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO); + tray.remove(trayIcon); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/HideTooltipsInExperiments.java b/src/main/java/me/Danker/features/HideTooltipsInExperiments.java new file mode 100644 index 0000000..5866fc8 --- /dev/null +++ b/src/main/java/me/Danker/features/HideTooltipsInExperiments.java @@ -0,0 +1,35 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class HideTooltipsInExperiments { + + @SubscribeEvent(priority = EventPriority.LOW) + public void onTooltipLow(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + + if (mc.currentScreen instanceof GuiChest) { + ContainerChest chest = (ContainerChest) player.openContainer; + IInventory inv = chest.getLowerChestInventory(); + String chestName = inv.getDisplayName().getUnformattedText(); + + if (ToggleCommand.hideTooltipsInExperimentAddonsToggled && (chestName.startsWith("Ultrasequencer (") || chestName.startsWith("Chronomatron ("))) { + event.toolTip.clear(); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/LowHealthNotifications.java b/src/main/java/me/Danker/features/LowHealthNotifications.java new file mode 100644 index 0000000..0bf2898 --- /dev/null +++ b/src/main/java/me/Danker/features/LowHealthNotifications.java @@ -0,0 +1,36 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class LowHealthNotifications { + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 2 == 0) { + if (ToggleCommand.lowHealthNotifyToggled && Utils.inDungeons && world != null) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String score : scoreboard) { + if (score.endsWith("❤") && score.matches(".* §c\\d.*")) { + String name = score.substring(score.indexOf(" ") + 1); + Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!\n" + name, 1); + break; + } + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/NecronNotifications.java b/src/main/java/me/Danker/features/NecronNotifications.java new file mode 100644 index 0000000..a1d4d26 --- /dev/null +++ b/src/main/java/me/Danker/features/NecronNotifications.java @@ -0,0 +1,78 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.List; + +public class NecronNotifications { + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inDungeons) return; + + if (ToggleCommand.necronNotificationsToggled && message.contains("[BOSS] Necron:")) { + Minecraft mc = Minecraft.getMinecraft(); + World world = mc.theWorld; + if (message.contains("You tricked me!") || message.contains("That beam, it hurts! IT HURTS!!")) { + Utils.createTitle(EnumChatFormatting.RED + "NECRON STUCK!", 2); + } else if (message.contains("STOP USING MY FACTORY AGAINST ME!") || message.contains("OOF") || message.contains("ANOTHER TRAP!! YOUR TRICKS ARE FUTILE!") || message.contains("SERIOUSLY? AGAIN?!") || message.contains("STOP!!!!!")) { + List necronLabels = world.getEntities(EntityArmorStand.class, (entity -> { + if (!entity.hasCustomName()) return false; + if (!entity.getCustomNameTag().contains("Necron")) return false; + return true; + })); + if (necronLabels.size() == 0) { + Utils.createTitle(EnumChatFormatting.WHITE + "NECRON STUNNED!", 2); + } else { + EntityArmorStand necron = necronLabels.get(0); + double x = necron.posX; + double z = necron.posZ; + + BlockPos blockPos = new BlockPos(x, 168, z); + + IBlockState blockState = world.getBlockState(blockPos); + Block block = blockState.getBlock(); + + if (block != Blocks.stained_hardened_clay) { + Utils.createTitle(EnumChatFormatting.WHITE + "NECRON STUNNED!", 2); + } else { + switch (block.getDamageValue(world, blockPos)) { + case 4: + Utils.createTitle(EnumChatFormatting.YELLOW + "YELLOW PILLAR!", 2); + break; + case 5: + Utils.createTitle(EnumChatFormatting.DARK_GREEN + "GREEN PILLAR!", 2); + break; + case 11: + Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "PURPLE PILLAR!", 2); + break; + default: + Utils.createTitle(EnumChatFormatting.WHITE + "NECRON STUNNED!", 2); + } + } + + } + } else if (message.contains("I'VE HAD ENOUGH! YOU'RE NOT HITTING ME WITH ANY MORE PILLARS!")) { + Utils.createTitle(EnumChatFormatting.RED + "RED PILLAR!", 2); + } else if (message.contains("ARGH!")) { + Utils.createTitle(EnumChatFormatting.RED + "EXPLOSION OVER!", 2); + } + } + + } + +} diff --git a/src/main/java/me/Danker/features/NoF3Coords.java b/src/main/java/me/Danker/features/NoF3Coords.java new file mode 100644 index 0000000..4f362e6 --- /dev/null +++ b/src/main/java/me/Danker/features/NoF3Coords.java @@ -0,0 +1,33 @@ +package me.Danker.features; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class NoF3Coords { + + public static String COORDS_COLOUR; + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + Minecraft mc = Minecraft.getMinecraft(); + + if (ToggleCommand.coordsToggled) { + EntityPlayer player = mc.thePlayer; + + double xDir = (player.rotationYaw % 360 + 360) % 360; + if (xDir > 180) xDir -= 360; + xDir = (double) Math.round(xDir * 10d) / 10d; + double yDir = (double) Math.round(player.rotationPitch * 10d) / 10d; + + String coordText = COORDS_COLOUR + (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")"; + new TextRenderer(mc, coordText, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale); + } + } + +} diff --git a/src/main/java/me/Danker/features/NotifySlayerSlain.java b/src/main/java/me/Danker/features/NotifySlayerSlain.java new file mode 100644 index 0000000..ee0bc41 --- /dev/null +++ b/src/main/java/me/Danker/features/NotifySlayerSlain.java @@ -0,0 +1,88 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.event.entity.player.ArrowNockEvent; +import net.minecraftforge.event.entity.player.AttackEntityEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.Arrays; +import java.util.List; + +public class NotifySlayerSlain { + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + ItemStack item = event.entityPlayer.getHeldItem(); + if (item == null) return; + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + if (ToggleCommand.notifySlayerSlainToggled) { + if (ScoreboardHandler.getSidebarLines().stream().anyMatch(x -> ScoreboardHandler.cleanSB(x).contains("Boss slain!"))) { + if (ScoreboardHandler.getSidebarLines().stream().anyMatch(x -> { + String line = ScoreboardHandler.cleanSB(x); + return Arrays.stream(new String[]{"Howling Cave", "Ruins", "Graveyard", "Coal Mine", "Spider's Den"}).anyMatch(line::contains); + })) { + if (Utils.hasRightClickAbility(item)) { + List lore = Utils.getItemLore(item); + + int abilityLine = -1; + for (int i = 0; i < lore.size(); i++) { + String line = StringUtils.stripControlCodes(lore.get(i)); + if (line.startsWith("Item Ability:")) abilityLine = i; + if (abilityLine != -1 && i > abilityLine) { + if (line.toLowerCase().contains("damage")) { + Utils.createTitle(EnumChatFormatting.RED + "Boss slain!", 2); + break; + } + } + } + } + } + } + } + } + } + + @SubscribeEvent + public void onArrowNock(ArrowNockEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + + if (ToggleCommand.notifySlayerSlainToggled) { + if (ScoreboardHandler.getSidebarLines().stream().anyMatch(x -> ScoreboardHandler.cleanSB(x).contains("Boss slain!"))) { + if (ScoreboardHandler.getSidebarLines().stream().anyMatch(x -> { + String line = ScoreboardHandler.cleanSB(x); + return Arrays.stream(new String[]{"Howling Cave", "Ruins", "Graveyard", "Coal Mine", "Spider's Den"}).anyMatch(line::contains); + })) { + Utils.createTitle(EnumChatFormatting.RED + "Boss slain!", 2); + } + } + } + } + + @SubscribeEvent + public void onAttackingEntity(AttackEntityEvent event) { + if (ToggleCommand.notifySlayerSlainToggled && (event.target instanceof EntityZombie || event.target instanceof EntitySpider || event.target instanceof EntityWolf)) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + + for (String line : scoreboard) { + String cleanedLine = ScoreboardHandler.cleanSB(line); + if (cleanedLine.contains("Boss slain!")) { + Utils.createTitle(EnumChatFormatting.RED + "Boss slain!", 2); + break; + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/PetColours.java b/src/main/java/me/Danker/features/PetColours.java new file mode 100644 index 0000000..5889b12 --- /dev/null +++ b/src/main/java/me/Danker/features/PetColours.java @@ -0,0 +1,69 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.regex.Pattern; + +public class PetColours { + + static Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); + public static int PET_1_TO_9; + public static int PET_10_TO_19; + public static int PET_20_TO_29; + public static int PET_30_TO_39; + public static int PET_40_TO_49; + public static int PET_50_TO_59; + public static int PET_60_TO_69; + public static int PET_70_TO_79; + public static int PET_80_TO_89; + public static int PET_90_TO_99; + public static int PET_100; + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + if (ToggleCommand.petColoursToggled) { + for (Slot slot : event.slots) { + ItemStack item = slot.getStack(); + if (item == null) continue; + String name = item.getDisplayName(); + if (petPattern.matcher(StringUtils.stripControlCodes(name)).find()) { + if (name.endsWith("aHealer") || name.endsWith("aMage") || name.endsWith("aBerserk") || name.endsWith("aArcher") || name.endsWith("aTank")) + continue; + int colour; + int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]"))); + if (petLevel == 100) { + colour = PET_100; + } else if (petLevel >= 90) { + colour = PET_90_TO_99; + } else if (petLevel >= 80) { + colour = PET_80_TO_89; + } else if (petLevel >= 70) { + colour = PET_70_TO_79; + } else if (petLevel >= 60) { + colour = PET_60_TO_69; + } else if (petLevel >= 50) { + colour = PET_50_TO_59; + } else if (petLevel >= 40) { + colour = PET_40_TO_49; + } else if (petLevel >= 30) { + colour = PET_30_TO_39; + } else if (petLevel >= 20) { + colour = PET_20_TO_29; + } else if (petLevel >= 10) { + colour = PET_10_TO_19; + } else { + colour = PET_1_TO_9; + } + Utils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, colour + 0xBF000000); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/Reparty.java b/src/main/java/me/Danker/features/Reparty.java new file mode 100644 index 0000000..a404bf5 --- /dev/null +++ b/src/main/java/me/Danker/features/Reparty.java @@ -0,0 +1,143 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.RepartyCommand; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Reparty { + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + // Getting party + if (RepartyCommand.gettingParty) { + if (message.contains("-----")) { + switch(RepartyCommand.Delimiter) { + case 0: + System.out.println("Get Party Delimiter Cancelled"); + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; + case 1: + System.out.println("Done querying party"); + RepartyCommand.gettingParty = false; + RepartyCommand.Delimiter = 0; + event.setCanceled(true); + return; + } + }else if (message.startsWith("Party M") || message.startsWith("Party Leader")){ + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + + Pattern party_start_pattern = Pattern.compile("^Party Members \\((\\d+)\\)$"); + Pattern leader_pattern = Pattern.compile("^Party Leader: (?:\\[.+?] )?(\\w+) ●$"); + Pattern members_pattern = Pattern.compile(" (?:\\[.+?] )?(\\w+) ●"); + Matcher party_start = party_start_pattern.matcher(message); + Matcher leader = leader_pattern.matcher(message); + Matcher members = members_pattern.matcher(message); + + if (party_start.matches() && Integer.parseInt(party_start.group(1)) == 1) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You cannot reparty yourself.")); + RepartyCommand.partyThread.interrupt(); + } else if (leader.matches() && !(leader.group(1).equals(player.getName()))) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You are not party leader.")); + RepartyCommand.partyThread.interrupt(); + } else { + while (members.find()) { + String partyMember = members.group(1); + if (!partyMember.equals(player.getName())) { + RepartyCommand.party.add(partyMember); + System.out.println(partyMember); + } + } + } + event.setCanceled(true); + return; + } + } + // Disbanding party + if (RepartyCommand.disbanding) { + if (message.contains("-----")) { + switch (RepartyCommand.Delimiter) { + case 0: + System.out.println("Disband Delimiter Cancelled"); + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; + case 1: + System.out.println("Done disbanding"); + RepartyCommand.disbanding = false; + RepartyCommand.Delimiter = 0; + event.setCanceled(true); + return; + } + } else if (message.endsWith("has disbanded the party!")) { + event.setCanceled(true); + return; + } + } + // Inviting + if (RepartyCommand.inviting) { + if (message.contains("-----")) { + switch (RepartyCommand.Delimiter) { + case 1: + event.setCanceled(true); + RepartyCommand.Delimiter = 0; + System.out.println("Player Invited!"); + RepartyCommand.inviting = false; + return; + case 0: + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; + } + } else if (message.endsWith(" to the party! They have 60 seconds to accept.")) { + Pattern invitePattern = Pattern.compile("(?:(?:\\[.+?] )?(?:\\w+) invited )(?:\\[.+?] )?(\\w+)"); + Matcher invitee = invitePattern.matcher(message); + if (invitee.find()) { + System.out.println("" + invitee.group(1) + ": " + RepartyCommand.repartyFailList.remove(invitee.group(1))); + } + event.setCanceled(true); + return; + } else if (message.contains("Couldn't find a player") || message.contains("You cannot invite that player")) { + event.setCanceled(true); + return; + } + } + // Fail Inviting + if (RepartyCommand.failInviting) { + if (message.contains("-----")) { + switch (RepartyCommand.Delimiter) { + case 1: + event.setCanceled(true); + RepartyCommand.Delimiter = 0; + System.out.println("Player Invited!"); + RepartyCommand.inviting = false; + return; + case 0: + RepartyCommand.Delimiter++; + event.setCanceled(true); + } + } else if (message.endsWith(" to the party! They have 60 seconds to accept.")) { + Pattern invitePattern = Pattern.compile("(?:(?:\\[.+?] )?(?:\\w+) invited )(?:\\[.+?] )?(\\w+)"); + Matcher invitee = invitePattern.matcher(message); + if (invitee.find()) { + System.out.println("" + invitee.group(1) + ": " + RepartyCommand.repartyFailList.remove(invitee.group(1))); + } + event.setCanceled(true); + } else if (message.contains("Couldn't find a player") || message.contains("You cannot invite that player")) { + event.setCanceled(true); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/Skill50Display.java b/src/main/java/me/Danker/features/Skill50Display.java new file mode 100644 index 0000000..511bb16 --- /dev/null +++ b/src/main/java/me/Danker/features/Skill50Display.java @@ -0,0 +1,77 @@ +package me.Danker.features; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.text.NumberFormat; +import java.util.Locale; + +public class Skill50Display { + + public static int SKILL_TIME; + public static int skillTimer = -1; + public static boolean showSkill = false; + public static String skillText = ""; + public static String SKILL_50_COLOUR; + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onChat(ClientChatReceivedEvent event) { + if (!Utils.inSkyblock || event.type != 2) return; + + String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); + + for (String section : actionBarSections) { + if (section.contains("+") && section.contains("/") && section.contains("(")) { + if (ToggleCommand.skill50DisplayToggled && !section.contains("Runecrafting")) { + String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); + double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); + int limit; + int totalXp; + if (section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining")) { + limit = 60; + totalXp = 111672425; + } else { + limit = 50; + totalXp = 55172425; + } + int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + double percentage = Math.floor(((currentXp + previousXp) / totalXp) * 10000D) / 100D; + + NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); + skillTimer = SKILL_TIME; + showSkill = true; + skillText = SKILL_50_COLOUR + xpGained + " (" + nf.format(currentXp + previousXp) + "/" + nf.format(totalXp) + ") " + percentage + "%"; + } + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + if (skillTimer >= 0) { + if (skillTimer == 0) { + showSkill = false; + } + skillTimer--; + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (showSkill) { + new TextRenderer(Minecraft.getMinecraft(), skillText, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale); + } + } + +} diff --git a/src/main/java/me/Danker/features/SkillTracker.java b/src/main/java/me/Danker/features/SkillTracker.java new file mode 100644 index 0000000..15e9fdd --- /dev/null +++ b/src/main/java/me/Danker/features/SkillTracker.java @@ -0,0 +1,208 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +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.inventory.GuiChest; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import org.apache.commons.lang3.time.StopWatch; + +import java.text.NumberFormat; +import java.util.Locale; + +public class SkillTracker { + + static String lastSkill = "Farming"; + public static boolean showSkillTracker; + public static StopWatch skillStopwatch = new StopWatch(); + static double farmingXP = 0; + public static double farmingXPGained = 0; + static double miningXP = 0; + public static double miningXPGained = 0; + static double combatXP = 0; + public static double combatXPGained = 0; + static double foragingXP = 0; + public static double foragingXPGained = 0; + static double fishingXP = 0; + public static double fishingXPGained = 0; + static double enchantingXP = 0; + public static double enchantingXPGained = 0; + static double alchemyXP = 0; + public static double alchemyXPGained = 0; + static double xpLeft = 0; + static double timeSinceGained = 0; + public static String SKILL_TRACKER_COLOUR; + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onChat(ClientChatReceivedEvent event) { + if (!Utils.inSkyblock || event.type != 2) return; + + String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); + + for (String section : actionBarSections) { + if (section.contains("+") && section.contains("/") && section.contains("(")) { + if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { + if (ToggleCommand.autoSkillTrackerToggled && System.currentTimeMillis() / 1000 - timeSinceGained <= 2) { + if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { + skillStopwatch.resume(); + } else if (!skillStopwatch.isStarted()) { + skillStopwatch.start(); + } + } + timeSinceGained = System.currentTimeMillis() / 1000; + + int limit = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") ? 60 : 50; + double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); + int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")); + xpLeft = xpToLevelUp - currentXP; + int previousXP = Utils.getPastXpEarned(xpToLevelUp, limit); + double totalXP = currentXP + previousXP; + + String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); + switch (skill) { + case "Farming": + lastSkill = "Farming"; + if (farmingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) farmingXPGained += totalXP - farmingXP; + } + farmingXP = totalXP; + break; + case "Mining": + lastSkill = "Mining"; + if (miningXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) miningXPGained += totalXP - miningXP; + } + miningXP = totalXP; + break; + case "Combat": + lastSkill = "Combat"; + if (combatXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) combatXPGained += totalXP - combatXP; + } + combatXP = totalXP; + break; + case "Foraging": + lastSkill = "Foraging"; + if (foragingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) foragingXPGained += totalXP - foragingXP; + } + foragingXP = totalXP; + break; + case "Fishing": + lastSkill = "Fishing"; + if (fishingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) fishingXPGained += totalXP - fishingXP; + } + fishingXP = totalXP; + break; + case "Enchanting": + lastSkill = "Enchanting"; + if (enchantingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) enchantingXPGained += totalXP - enchantingXP; + } + enchantingXP = totalXP; + break; + case "Alchemy": + lastSkill = "Alchemy"; + if (alchemyXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) alchemyXPGained += totalXP - alchemyXP; + } + alchemyXP = totalXP; + break; + default: + System.err.println("Unknown skill."); + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (showSkillTracker && Utils.inSkyblock) { + int xpPerHour; + double xpToShow = 0; + switch (lastSkill) { + case "Farming": + xpToShow = farmingXPGained; + break; + case "Mining": + xpToShow = miningXPGained; + break; + case "Combat": + xpToShow = combatXPGained; + break; + case "Foraging": + xpToShow = foragingXPGained; + break; + case "Fishing": + xpToShow = fishingXPGained; + break; + case "Enchanting": + xpToShow = enchantingXPGained; + break; + case "Alchemy": + xpToShow = alchemyXPGained; + break; + default: + System.err.println("Unknown skill in rendering."); + } + xpPerHour = (int) Math.round(xpToShow / ((skillStopwatch.getTime() + 1) / 3600000d)); + String skillTrackerText = SKILL_TRACKER_COLOUR + lastSkill + " XP Earned: " + NumberFormat.getNumberInstance(Locale.US).format(xpToShow) + "\n" + + SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, skillStopwatch.getTime() / 1000d) + "\n" + + SKILL_TRACKER_COLOUR + "XP Per Hour: " + NumberFormat.getIntegerInstance(Locale.US).format(xpPerHour); + if (xpLeft >= 0) { + String time = xpPerHour == 0 ? "Never" : Utils.getTimeBetween(0, xpLeft / (xpPerHour / 3600D)); + skillTrackerText += "\n" + SKILL_TRACKER_COLOUR + "Time Until Next Level: " + time; + } + if (!skillStopwatch.isStarted() || skillStopwatch.isSuspended()) { + skillTrackerText += "\n" + EnumChatFormatting.RED + "PAUSED"; + } + + new TextRenderer(Minecraft.getMinecraft(), skillTrackerText, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], ScaleCommand.skillTrackerScale); + } + } + + @SubscribeEvent + public void onKey(InputEvent.KeyInputEvent event) { + if (!Utils.inSkyblock) return; + + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (DankersSkyblockMod.keyBindings[2].isPressed()) { + if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { + skillStopwatch.resume(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); + } else if (!skillStopwatch.isStarted()) { + skillStopwatch.start(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); + } else if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { + skillStopwatch.suspend(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); + } + } + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + if (event.gui instanceof GuiChest) { + if (ToggleCommand.autoSkillTrackerToggled) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { + skillStopwatch.suspend(); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/SpamHider.java b/src/main/java/me/Danker/features/SpamHider.java new file mode 100644 index 0000000..4b22f61 --- /dev/null +++ b/src/main/java/me/Danker/features/SpamHider.java @@ -0,0 +1,51 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class SpamHider { + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (message.contains(":")) return; + + // Spirit Sceptre + if (!ToggleCommand.sceptreMessages && message.contains("Your Spirit Sceptre hit ")) { + event.setCanceled(true); + return; + } + // Midas Staff + if (!ToggleCommand.midasStaffMessages && message.contains("Your Molten Wave hit ")) { + event.setCanceled(true); + return; + } + // Heals + if (!ToggleCommand.healMessages && message.contains(" health!") && (message.contains("You healed ") || message.contains(" healed you for "))) { + event.setCanceled(true); + return; + } + // Ability Cooldown + if (!ToggleCommand.cooldownMessages && message.contains("This ability is on cooldown for ")) { + event.setCanceled(true); + return; + } + // Out of mana messages + if (!ToggleCommand.manaMessages && message.contains("You do not have enough mana to do this!")) { + event.setCanceled(true); + return; + } + // Implosion + if (!ToggleCommand.implosionMessages) { + if (message.contains("Your Implosion hit ") || message.contains("There are blocks in the way")) { + event.setCanceled(true); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/SpiritBearAlert.java b/src/main/java/me/Danker/features/SpiritBearAlert.java new file mode 100644 index 0000000..604fdf3 --- /dev/null +++ b/src/main/java/me/Danker/features/SpiritBearAlert.java @@ -0,0 +1,24 @@ +package me.Danker.features; + +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; + +public class SpiritBearAlert { + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (message.contains(":")) return; + + if (ToggleCommand.spiritBearAlerts && message.contains("The Spirit Bear has appeared!")) { + Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "SPIRIT BEAR", 2); + } + } + +} diff --git a/src/main/java/me/Danker/features/StopSalvagingStarredItems.java b/src/main/java/me/Danker/features/StopSalvagingStarredItems.java new file mode 100644 index 0000000..08d0c7a --- /dev/null +++ b/src/main/java/me/Danker/features/StopSalvagingStarredItems.java @@ -0,0 +1,34 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class StopSalvagingStarredItems { + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + ItemStack item = event.item; + if (ToggleCommand.stopSalvageStarredToggled && event.inventoryName.startsWith("Salvage")) { + if (item == null) return; + boolean inSalvageGui = false; + if (item.getDisplayName().contains("Salvage") || item.getDisplayName().contains("Essence")) { + ItemStack salvageItem = event.inventory.getStackInSlot(13); + if (salvageItem == null) return; + item = salvageItem; + inSalvageGui = true; + } + if (item.getDisplayName().contains("✪") && (event.slot.slotNumber > 53 || inSalvageGui)) { + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, 0.5f); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from salvaging that item!")); + event.setCanceled(true); + return; + } + } + } + +} diff --git a/src/main/java/me/Danker/features/UpdateChecker.java b/src/main/java/me/Danker/features/UpdateChecker.java new file mode 100644 index 0000000..747fe91 --- /dev/null +++ b/src/main/java/me/Danker/features/UpdateChecker.java @@ -0,0 +1,52 @@ +package me.Danker.features; + +import com.google.gson.JsonObject; +import me.Danker.DankersSkyblockMod; +import me.Danker.handlers.APIHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; + +public class UpdateChecker { + + static boolean updateChecked = false; + + @SubscribeEvent + public void onJoin(EntityJoinWorldEvent event) { + if (!updateChecked) { + updateChecked = true; + + // MULTI THREAD DRIFTING + new Thread(() -> { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + + System.out.println("Checking for updates..."); + JsonObject latestRelease = APIHandler.getResponse("https://api.github.com/repos/bowser0000/SkyblockMod/releases/latest"); + + String latestTag = latestRelease.get("tag_name").getAsString(); + DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(DankersSkyblockMod.VERSION); + DefaultArtifactVersion latestVersion = new DefaultArtifactVersion(latestTag.substring(1)); + + if (currentVersion.compareTo(latestVersion) < 0) { + String releaseURL = latestRelease.get("html_url").getAsString(); + + ChatComponentText update = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [UPDATE] "); + update.setChatStyle(update.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, releaseURL))); + + try { + Thread.sleep(2000); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + DankersSkyblockMod.MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update)); + } + }).start(); + } + } + +} diff --git a/src/main/java/me/Danker/features/WatcherReadyAlert.java b/src/main/java/me/Danker/features/WatcherReadyAlert.java new file mode 100644 index 0000000..b68ccc2 --- /dev/null +++ b/src/main/java/me/Danker/features/WatcherReadyAlert.java @@ -0,0 +1,22 @@ +package me.Danker.features; + +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; + +public class WatcherReadyAlert { + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inDungeons) return; + + if (message.contains("[BOSS] The Watcher: That will be enough for now.")) { + if (ToggleCommand.watcherReadyToggled) Utils.createTitle(EnumChatFormatting.RED + "WATCHER READY", 2); + } + } +} diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java new file mode 100644 index 0000000..d4868e3 --- /dev/null +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -0,0 +1,903 @@ +package me.Danker.features.loot; + +import me.Danker.commands.DisplayCommand; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.text.NumberFormat; +import java.util.Locale; + +public class LootDisplay { + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (!DisplayCommand.display.equals("off")) { + Minecraft mc = Minecraft.getMinecraft(); + String dropsText = ""; + String countText = ""; + String dropsTextTwo; + String countTextTwo; + String timeBetween; + String bossesBetween; + String drop20; + double timeNow = System.currentTimeMillis() / 1000; + NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + + switch (DisplayCommand.display) { + case "wolf": + if (LootTracker.wolfTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.wolfTime, timeNow); + } + if (LootTracker.wolfBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.wolfBosses); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.wolfWheels); + } else { + drop20 = nf.format(LootTracker.wolfWheelsDrops) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Svens Killed:\n" + + EnumChatFormatting.GREEN + "Wolf Teeth:\n" + + EnumChatFormatting.BLUE + "Hamster Wheels:\n" + + EnumChatFormatting.AQUA + "Spirit Runes:\n" + + EnumChatFormatting.WHITE + "Critical VI Books:\n" + + EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" + + EnumChatFormatting.GOLD + "Couture Runes:\n" + + EnumChatFormatting.AQUA + "Grizzly Baits:\n" + + EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.wolfSvens) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.wolfTeeth) + "\n" + + EnumChatFormatting.BLUE + drop20 + "\n" + + EnumChatFormatting.AQUA + LootTracker.wolfSpirits + "\n" + + EnumChatFormatting.WHITE + LootTracker.wolfBooks + "\n" + + EnumChatFormatting.DARK_RED + LootTracker.wolfEggs + "\n" + + EnumChatFormatting.GOLD + LootTracker.wolfCoutures + "\n" + + EnumChatFormatting.AQUA + LootTracker.wolfBaits + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.wolfFluxes + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "wolf_session": + if (LootTracker.wolfTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.wolfTimeSession, timeNow); + } + if (LootTracker.wolfBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.wolfBossesSession); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.wolfWheelsSession); + } else { + drop20 = nf.format(LootTracker.wolfWheelsDropsSession) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Svens Killed:\n" + + EnumChatFormatting.GREEN + "Wolf Teeth:\n" + + EnumChatFormatting.BLUE + "Hamster Wheels:\n" + + EnumChatFormatting.AQUA + "Spirit Runes:\n" + + EnumChatFormatting.WHITE + "Critical VI Books:\n" + + EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" + + EnumChatFormatting.GOLD + "Couture Runes:\n" + + EnumChatFormatting.AQUA + "Grizzly Baits:\n" + + EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.wolfSvensSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.wolfTeethSession) + "\n" + + EnumChatFormatting.BLUE + drop20 + "\n" + + EnumChatFormatting.AQUA + LootTracker.wolfSpiritsSession + "\n" + + EnumChatFormatting.WHITE + LootTracker.wolfBooksSession + "\n" + + EnumChatFormatting.DARK_RED + LootTracker.wolfEggsSession + "\n" + + EnumChatFormatting.GOLD + LootTracker.wolfCouturesSession + "\n" + + EnumChatFormatting.AQUA + LootTracker.wolfBaitsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.wolfFluxesSession + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "spider": + if (LootTracker.spiderTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.spiderTime, timeNow); + } + if (LootTracker.spiderBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.spiderBosses); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.spiderTAP); + } else { + drop20 = nf.format(LootTracker.spiderTAPDrops) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Tarantulas Killed:\n" + + EnumChatFormatting.GREEN + "Tarantula Webs:\n" + + EnumChatFormatting.DARK_GREEN + "Arrow Poison:\n" + + EnumChatFormatting.DARK_GRAY + "Bite Runes:\n" + + EnumChatFormatting.WHITE + "Bane VI Books:\n" + + EnumChatFormatting.AQUA + "Spider Catalysts:\n" + + EnumChatFormatting.DARK_PURPLE + "Tarantula Talismans:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Fly Swatters:\n" + + EnumChatFormatting.GOLD + "Digested Mosquitos:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.spiderTarantulas) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.spiderWebs) + "\n" + + EnumChatFormatting.DARK_GREEN + drop20 + "\n" + + EnumChatFormatting.DARK_GRAY + LootTracker.spiderBites + "\n" + + EnumChatFormatting.WHITE + LootTracker.spiderBooks + "\n" + + EnumChatFormatting.AQUA + LootTracker.spiderCatalysts + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.spiderTalismans + "\n" + + EnumChatFormatting.LIGHT_PURPLE + LootTracker.spiderSwatters + "\n" + + EnumChatFormatting.GOLD + LootTracker.spiderMosquitos + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "spider_session": + if (LootTracker.spiderTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.spiderTimeSession, timeNow); + } + if (LootTracker.spiderBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.spiderBossesSession); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.spiderTAPSession); + } else { + drop20 = nf.format(LootTracker.spiderTAPDropsSession) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Tarantulas Killed:\n" + + EnumChatFormatting.GREEN + "Tarantula Webs:\n" + + EnumChatFormatting.DARK_GREEN + "Arrow Poison:\n" + + EnumChatFormatting.DARK_GRAY + "Bite Runes:\n" + + EnumChatFormatting.WHITE + "Bane VI Books:\n" + + EnumChatFormatting.AQUA + "Spider Catalysts:\n" + + EnumChatFormatting.DARK_PURPLE + "Tarantula Talismans:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Fly Swatters:\n" + + EnumChatFormatting.GOLD + "Digested Mosquitos:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.spiderTarantulasSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.spiderWebsSession) + "\n" + + EnumChatFormatting.DARK_GREEN + drop20 + "\n" + + EnumChatFormatting.DARK_GRAY + LootTracker.spiderBitesSession + "\n" + + EnumChatFormatting.WHITE + LootTracker.spiderBooksSession + "\n" + + EnumChatFormatting.AQUA + LootTracker.spiderCatalystsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.spiderTalismansSession + "\n" + + EnumChatFormatting.LIGHT_PURPLE + LootTracker.spiderSwattersSession + "\n" + + EnumChatFormatting.GOLD + LootTracker.spiderMosquitosSession + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "zombie": + if (LootTracker.zombieTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.zombieTime, timeNow); + } + if (LootTracker.zombieBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.zombieBosses); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.zombieFoulFlesh); + } else { + drop20 = nf.format(LootTracker.zombieFoulFleshDrops) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" + + EnumChatFormatting.GREEN + "Revenant Flesh:\n" + + EnumChatFormatting.BLUE + "Foul Flesh:\n" + + EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" + + EnumChatFormatting.WHITE + "Smite VI Books:\n" + + EnumChatFormatting.AQUA + "Undead Catalysts:\n" + + EnumChatFormatting.DARK_PURPLE + "Beheaded Horrors:\n" + + EnumChatFormatting.RED + "Revenant Catalysts:\n" + + EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" + + EnumChatFormatting.GOLD + "Scythe Blades:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.zombieRevs) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.zombieRevFlesh) + "\n" + + EnumChatFormatting.BLUE + drop20 + "\n" + + EnumChatFormatting.DARK_GREEN + LootTracker.zombiePestilences + "\n" + + EnumChatFormatting.WHITE + LootTracker.zombieBooks + "\n" + + EnumChatFormatting.AQUA + LootTracker.zombieUndeadCatas + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.zombieBeheadeds + "\n" + + EnumChatFormatting.RED + LootTracker.zombieRevCatas + "\n" + + EnumChatFormatting.DARK_GREEN + LootTracker.zombieSnakes + "\n" + + EnumChatFormatting.GOLD + LootTracker.zombieScythes + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "zombie_session": + if (LootTracker.zombieTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.zombieTimeSession, timeNow); + } + if (LootTracker.zombieBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.zombieBossesSession); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.zombieFoulFleshSession); + } else { + drop20 = nf.format(LootTracker.zombieFoulFleshDropsSession) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" + + EnumChatFormatting.GREEN + "Revenant Flesh:\n" + + EnumChatFormatting.BLUE + "Foul Flesh:\n" + + EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" + + EnumChatFormatting.WHITE + "Smite VI Books:\n" + + EnumChatFormatting.AQUA + "Undead Catalysts:\n" + + EnumChatFormatting.DARK_PURPLE + "Beheaded Horrors:\n" + + EnumChatFormatting.RED + "Revenant Catalysts:\n" + + EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" + + EnumChatFormatting.GOLD + "Scythe Blades:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.zombieRevsSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.zombieRevFleshSession) + "\n" + + EnumChatFormatting.BLUE + drop20 + "\n" + + EnumChatFormatting.DARK_GREEN + LootTracker.zombiePestilencesSession + "\n" + + EnumChatFormatting.WHITE + LootTracker.zombieBooksSession + "\n" + + EnumChatFormatting.AQUA + LootTracker.zombieUndeadCatasSession + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.zombieBeheadedsSession + "\n" + + EnumChatFormatting.RED + LootTracker.zombieRevCatasSession + "\n" + + EnumChatFormatting.DARK_GREEN + LootTracker.zombieSnakesSession + "\n" + + EnumChatFormatting.GOLD + LootTracker.zombieScythes + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "fishing": + if (LootTracker.empTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.empTime, timeNow); + } + if (LootTracker.empSCs == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.empSCs); + } + + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.GRAY + "Squids:\n" + + EnumChatFormatting.GREEN + "Sea Walkers:\n" + + EnumChatFormatting.DARK_GRAY + "Night Squids:\n" + + EnumChatFormatting.DARK_AQUA + "Sea Guardians:\n" + + EnumChatFormatting.BLUE + "Sea Witches:\n" + + EnumChatFormatting.GREEN + "Sea Archers:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatches) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.squids) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.seaWalkers) + "\n" + + EnumChatFormatting.DARK_GRAY + nf.format(LootTracker.nightSquids) + "\n" + + EnumChatFormatting.DARK_AQUA + nf.format(LootTracker.seaGuardians) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.seaWitches) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.seaArchers); + // Seperated to save vertical space + dropsTextTwo = EnumChatFormatting.GREEN + "Monster of Deeps:\n" + + EnumChatFormatting.YELLOW + "Catfishes:\n" + + EnumChatFormatting.GOLD + "Carrot Kings:\n" + + EnumChatFormatting.GRAY + "Sea Leeches:\n" + + EnumChatFormatting.DARK_PURPLE + "Guardian Defenders:\n" + + EnumChatFormatting.DARK_PURPLE + "Deep Sea Protectors:\n" + + EnumChatFormatting.GOLD + "Hydras:\n" + + EnumChatFormatting.GOLD + "Sea Emperors:\n" + + EnumChatFormatting.AQUA + "Time Since Emp:\n" + + EnumChatFormatting.AQUA + "Creatures Since Emp:"; + countTextTwo = EnumChatFormatting.GREEN + nf.format(LootTracker.monsterOfTheDeeps) + "\n" + + EnumChatFormatting.YELLOW + nf.format(LootTracker.catfishes) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.carrotKings) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.seaLeeches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.guardianDefenders) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.deepSeaProtectors) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.hydras) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.seaEmperors) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + + if (ToggleCommand.splitFishing) { + new TextRenderer(mc, dropsTextTwo, (int) (MoveCommand.displayXY[0] + (160 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(mc, countTextTwo, (int) (MoveCommand.displayXY[0] + (270 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + } else { + dropsText += "\n" + dropsTextTwo; + countText += "\n" + countTextTwo; + } + break; + case "fishing_session": + if (LootTracker.empTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.empTimeSession, timeNow); + } + if (LootTracker.empSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.empSCsSession); + } + + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.GRAY + "Squids:\n" + + EnumChatFormatting.GREEN + "Sea Walkers:\n" + + EnumChatFormatting.DARK_GRAY + "Night Squids:\n" + + EnumChatFormatting.DARK_AQUA + "Sea Guardians:\n" + + EnumChatFormatting.BLUE + "Sea Witches:\n" + + EnumChatFormatting.GREEN + "Sea Archers:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.squidsSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.seaWalkersSession) + "\n" + + EnumChatFormatting.DARK_GRAY + nf.format(LootTracker.nightSquidsSession) + "\n" + + EnumChatFormatting.DARK_AQUA + nf.format(LootTracker.seaGuardiansSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.seaWitchesSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.seaArchersSession); + // Seperated to save vertical space + dropsTextTwo = EnumChatFormatting.GREEN + "Monster of Deeps:\n" + + EnumChatFormatting.YELLOW + "Catfishes:\n" + + EnumChatFormatting.GOLD + "Carrot Kings:\n" + + EnumChatFormatting.GRAY + "Sea Leeches:\n" + + EnumChatFormatting.DARK_PURPLE + "Guardian Defenders:\n" + + EnumChatFormatting.DARK_PURPLE + "Deep Sea Protectors:\n" + + EnumChatFormatting.GOLD + "Hydras:\n" + + EnumChatFormatting.GOLD + "Sea Emperors:\n" + + EnumChatFormatting.AQUA + "Time Since Emp:\n" + + EnumChatFormatting.AQUA + "Creatures Since Emp:"; + countTextTwo = EnumChatFormatting.GREEN + nf.format(LootTracker.monsterOfTheDeepsSession) + "\n" + + EnumChatFormatting.YELLOW + nf.format(LootTracker.catfishesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.carrotKingsSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.seaLeechesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.guardianDefendersSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.deepSeaProtectorsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.hydrasSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.seaEmperorsSession) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + + if (ToggleCommand.splitFishing) { + new TextRenderer(mc, dropsTextTwo, (int) (MoveCommand.displayXY[0] + (160 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(mc, countTextTwo, (int) (MoveCommand.displayXY[0] + (270 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + } else { + dropsText += "\n" + dropsTextTwo; + countText += "\n" + countTextTwo; + } + break; + case "fishing_winter": + if (LootTracker.yetiTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.yetiTime, timeNow); + } + if (LootTracker.yetiSCs == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.yetiSCs); + } + + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.AQUA + "Frozen Steves:\n" + + EnumChatFormatting.WHITE + "Snowmans:\n" + + EnumChatFormatting.DARK_GREEN + "Grinches:\n" + + EnumChatFormatting.GOLD + "Yetis:\n" + + EnumChatFormatting.AQUA + "Time Since Yeti:\n" + + EnumChatFormatting.AQUA + "Creatures Since Yeti:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatches) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.frozenSteves) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.frostyTheSnowmans) + "\n" + + EnumChatFormatting.DARK_GREEN + nf.format(LootTracker.grinches) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.yetis) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "fishing_winter_session": + if (LootTracker.yetiTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.yetiTimeSession, timeNow); + } + if (LootTracker.yetiSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.yetiSCsSession); + } + + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.AQUA + "Frozen Steves:\n" + + EnumChatFormatting.WHITE + "Snowmans:\n" + + EnumChatFormatting.DARK_GREEN + "Grinches:\n" + + EnumChatFormatting.GOLD + "Yetis:\n" + + EnumChatFormatting.AQUA + "Time Since Yeti:\n" + + EnumChatFormatting.AQUA + "Creatures Since Yeti:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.frozenStevesSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.frostyTheSnowmansSession) + "\n" + + EnumChatFormatting.DARK_GREEN + nf.format(LootTracker.grinchesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.yetisSession) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "fishing_festival": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Nurse Sharks:\n" + + EnumChatFormatting.BLUE + "Blue Sharks:\n" + + EnumChatFormatting.GOLD + "Tiger Sharks:\n" + + EnumChatFormatting.WHITE + "Great White Sharks:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatches) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(LootTracker.nurseSharks) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.blueSharks) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.tigerSharks) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.greatWhiteSharks); + break; + case "fishing_festival_session": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Nurse Sharks:\n" + + EnumChatFormatting.BLUE + "Blue Sharks:\n" + + EnumChatFormatting.GOLD + "Tiger Sharks:\n" + + EnumChatFormatting.WHITE + "Great White Sharks:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(LootTracker.nurseSharksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.blueSharksSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.tigerSharksSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.greatWhiteSharksSession); + break; + case "fishing_spooky": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.BLUE + "Scarecrows:\n" + + EnumChatFormatting.GRAY + "Nightmares:\n" + + EnumChatFormatting.DARK_PURPLE + "Werewolves:\n" + + EnumChatFormatting.GOLD + "Phantom Fishers:\n" + + EnumChatFormatting.GOLD + "Grim Reapers:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatches) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.scarecrows) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.nightmares) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.werewolfs) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.phantomFishers) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.grimReapers); + break; + case "fishing_spooky_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 + "Scarecrows:\n" + + EnumChatFormatting.GRAY + "Nightmares:\n" + + EnumChatFormatting.DARK_PURPLE + "Werewolves:\n" + + EnumChatFormatting.GOLD + "Phantom Fishers:\n" + + EnumChatFormatting.GOLD + "Grim Reapers:"; + countText = EnumChatFormatting.AQUA + nf.format(LootTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.scarecrowsSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.nightmaresSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.werewolfsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.phantomFishersSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.grimReapersSession); + break; + case "mythological": + dropsText = EnumChatFormatting.GOLD + "Coins:\n" + + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + + EnumChatFormatting.GOLD + "Crown of Greeds:\n" + + EnumChatFormatting.AQUA + "Washed up Souvenirs:\n" + + EnumChatFormatting.RED + "Minos Hunters:\n" + + EnumChatFormatting.GRAY + "Siamese Lynxes:\n" + + EnumChatFormatting.RED + "Minotaurs:\n" + + EnumChatFormatting.WHITE + "Gaia Constructs:\n" + + EnumChatFormatting.DARK_PURPLE + "Minos Champions:\n" + + EnumChatFormatting.GOLD + "Minos Inquisitors:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.mythCoins) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.griffinFeathers) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.crownOfGreeds) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.washedUpSouvenirs) + "\n" + + EnumChatFormatting.RED + nf.format(LootTracker.minosHunters) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.siameseLynxes) + "\n" + + EnumChatFormatting.RED + nf.format(LootTracker.minotaurs) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.gaiaConstructs) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.minosChampions) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.minosInquisitors); + break; + case "mythological_session": + dropsText = EnumChatFormatting.GOLD + "Coins:\n" + + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + + EnumChatFormatting.GOLD + "Crown of Greeds:\n" + + EnumChatFormatting.AQUA + "Washed up Souvenirs:\n" + + EnumChatFormatting.RED + "Minos Hunters:\n" + + EnumChatFormatting.GRAY + "Siamese Lynxes:\n" + + EnumChatFormatting.RED + "Minotaurs:\n" + + EnumChatFormatting.WHITE + "Gaia Constructs:\n" + + EnumChatFormatting.DARK_PURPLE + "Minos Champions:\n" + + EnumChatFormatting.GOLD + "Minos Inquisitors:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.mythCoinsSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.griffinFeathersSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.crownOfGreedsSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(LootTracker.washedUpSouvenirsSession) + "\n" + + EnumChatFormatting.RED + nf.format(LootTracker.minosHuntersSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(LootTracker.siameseLynxesSession) + "\n" + + EnumChatFormatting.RED + nf.format(LootTracker.minotaursSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(LootTracker.gaiaConstructsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.minosChampionsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.minosInquisitorsSession); + break; + case "catacombs_floor_one": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.bonzoStaffs) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f1CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f1TimeSpent); + break; + case "catacombs_floor_one_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.bonzoStaffsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f1CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f1TimeSpentSession); + break; + case "catacombs_floor_two": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.scarfStudies) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveSwords) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f2CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f2TimeSpent); + break; + case "catacombs_floor_two_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.scarfStudiesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveSwordsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f2CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f2TimeSpentSession); + break; + case "catacombs_floor_three": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveHelms) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveChests) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveLegs) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveBoots) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f3CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f3TimeSpent); + break; + case "catacombs_floor_three_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveHelmsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveChestsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveLegsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.adaptiveBootsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f3CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f3TimeSpentSession); + break; + case "catacombs_floor_four": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Wings:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Bones:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Swords:\n" + + EnumChatFormatting.GOLD + "Spirit Bows:\n" + + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + + EnumChatFormatting.GOLD + "Leg Spirit Pets:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritWings) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritBones) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritBoots) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritSwords) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.spiritBows) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.epicSpiritPets) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.legSpiritPets) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f4CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f4TimeSpent); + break; + case "catacombs_floor_four_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Wings:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Bones:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Swords:\n" + + EnumChatFormatting.GOLD + "Spirit Bows:\n" + + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + + EnumChatFormatting.GOLD + "Leg Spirit Pets:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritWingsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritBonesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritBootsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.spiritSwordsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.spiritBowsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.epicSpiritPetsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.legSpiritPetsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f4CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f4TimeSpentSession); + break; + case "catacombs_floor_five": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Warped Stones:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + + EnumChatFormatting.GOLD + "Last Breaths:\n" + + EnumChatFormatting.GOLD + "Livid Daggers:\n" + + EnumChatFormatting.GOLD + "Shadow Furys:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.warpedStones) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssHelms) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssChests) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssLegs) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssBoots) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.lastBreaths) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.lividDaggers) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.shadowFurys) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f5CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f5TimeSpent); + break; + case "catacombs_floor_five_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Warped Stones:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + + EnumChatFormatting.GOLD + "Last Breaths:\n" + + EnumChatFormatting.GOLD + "Livid Daggers:\n" + + EnumChatFormatting.GOLD + "Shadow Furys:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.warpedStonesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssHelmsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssChestsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssLegsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowAssBootsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.lastBreathsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.lividDaggersSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.shadowFurysSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f5CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f5TimeSpentSession); + break; + case "catacombs_floor_six": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Ancient Roses:\n" + + EnumChatFormatting.GOLD + "Precursor Eyes:\n" + + EnumChatFormatting.GOLD + "Giant's Swords:\n" + + EnumChatFormatting.GOLD + "Necro Lord Helmets:\n" + + EnumChatFormatting.GOLD + "Necro Lord Chests:\n" + + EnumChatFormatting.GOLD + "Necro Lord Leggings:\n" + + EnumChatFormatting.GOLD + "Necro Lord Boots:\n" + + EnumChatFormatting.GOLD + "Necro Swords:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.ancientRoses) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.precursorEyes) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.giantsSwords) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordHelms) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordChests) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordLegs) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordBoots) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroSwords) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f6CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f6TimeSpent); + break; + case "catacombs_floor_six_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Ancient Roses:\n" + + EnumChatFormatting.GOLD + "Precursor Eyes:\n" + + EnumChatFormatting.GOLD + "Giant's Swords:\n" + + EnumChatFormatting.GOLD + "Necro Lord Helmets:\n" + + EnumChatFormatting.GOLD + "Necro Lord Chests:\n" + + EnumChatFormatting.GOLD + "Necro Lord Leggings:\n" + + EnumChatFormatting.GOLD + "Necro Lord Boots:\n" + + EnumChatFormatting.GOLD + "Necro Swords:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.ancientRosesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.precursorEyesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.giantsSwordsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordHelmsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordChestsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordLegsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroLordBootsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.necroSwordsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f6CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f6TimeSpentSession); + break; + case "catacombs_floor_seven": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "Wither Bloods:\n" + + EnumChatFormatting.DARK_PURPLE + "Wither Cloaks:\n" + + EnumChatFormatting.DARK_PURPLE + "Implosions:\n" + + EnumChatFormatting.DARK_PURPLE + "Wither Shields:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Warps:\n" + + EnumChatFormatting.DARK_PURPLE + "Necron's Handles:\n" + + EnumChatFormatting.GOLD + "Auto Recombobs:\n" + + EnumChatFormatting.GOLD + "Wither Helmets:\n" + + EnumChatFormatting.GOLD + "Wither Chests:\n" + + EnumChatFormatting.GOLD + "Wither Leggings:\n" + + EnumChatFormatting.GOLD + "Wither Boots:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.witherBloods) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.witherCloaks) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.implosions) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.witherShields) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowWarps) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.necronsHandles) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.autoRecombs) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherHelms) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherChests) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherLegs) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherBoots) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f7CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f7TimeSpent); + break; + case "catacombs_floor_seven_session": + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.DARK_PURPLE + "Wither Bloods:\n" + + EnumChatFormatting.DARK_PURPLE + "Wither Cloaks:\n" + + EnumChatFormatting.DARK_PURPLE + "Implosions:\n" + + EnumChatFormatting.DARK_PURPLE + "Wither Shields:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Warps:\n" + + EnumChatFormatting.DARK_PURPLE + "Necron's Handles:\n" + + EnumChatFormatting.GOLD + "Auto Recombobulators:\n" + + EnumChatFormatting.GOLD + "Wither Helmets:\n" + + EnumChatFormatting.GOLD + "Wither Chests:\n" + + EnumChatFormatting.GOLD + "Wither Leggings:\n" + + EnumChatFormatting.GOLD + "Wither Boots:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.witherBloodsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.witherCloaksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.implosionsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.witherShieldsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.shadowWarpsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.necronsHandlesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.autoRecombsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherHelmsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherChestsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherLegsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(LootTracker.witherBootsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f7CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f7TimeSpentSession); + break; + default: + System.out.println("Display was an unknown value, turning off."); + DisplayCommand.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", "off"); + } + new TextRenderer(mc, dropsText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(mc, countText, (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + } + } + +} diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java new file mode 100644 index 0000000..f7f7044 --- /dev/null +++ b/src/main/java/me/Danker/features/loot/LootTracker.java @@ -0,0 +1,1097 @@ +package me.Danker.features.loot; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.sound.PlaySoundEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.List; + +public class LootTracker { + + // Wolf + public static int wolfSvens; + public static int wolfTeeth; + public static int wolfWheels; + public static int wolfWheelsDrops; + public static int wolfSpirits; + public static int wolfBooks; + public static int wolfEggs; + public static int wolfCoutures; + public static int wolfBaits; + public static int wolfFluxes; + public static double wolfTime; + public static int wolfBosses; + // Spider + public static int spiderTarantulas; + public static int spiderWebs; + public static int spiderTAP; + public static int spiderTAPDrops; + public static int spiderBites; + public static int spiderCatalysts; + public static int spiderBooks; + public static int spiderSwatters; + public static int spiderTalismans; + public static int spiderMosquitos; + public static double spiderTime; + public static int spiderBosses; + // Zombie + public static int zombieRevs; + public static int zombieRevFlesh; + public static int zombieFoulFlesh; + public static int zombieFoulFleshDrops; + public static int zombiePestilences; + public static int zombieUndeadCatas; + public static int zombieBooks; + public static int zombieBeheadeds; + public static int zombieRevCatas; + public static int zombieSnakes; + public static int zombieScythes; + public static double zombieTime; + public static int zombieBosses; + + // Fishing + public static int seaCreatures; + public static int goodCatches; + public static int greatCatches; + public static int squids; + public static int seaWalkers; + public static int nightSquids; + public static int seaGuardians; + public static int seaWitches; + public static int seaArchers; + public static int monsterOfTheDeeps; + public static int catfishes; + public static int carrotKings; + public static int seaLeeches; + public static int guardianDefenders; + public static int deepSeaProtectors; + public static int hydras; + public static int seaEmperors; + public static double empTime; + public static int empSCs; + public static int fishingMilestone; + // Fishing Winter + public static int frozenSteves; + public static int frostyTheSnowmans; + public static int grinches; + public static int yetis; + public static double yetiTime; + public static int yetiSCs; + // Fishing Festival + public static int nurseSharks; + public static int blueSharks; + public static int tigerSharks; + public static int greatWhiteSharks; + // Spooky Fishing + public static int scarecrows; + public static int nightmares; + public static int werewolfs; + public static int phantomFishers; + public static int grimReapers; + + // Mythological + public static double mythCoins; + public static int griffinFeathers; + public static int crownOfGreeds; + public static int washedUpSouvenirs; + public static int minosHunters; + public static int siameseLynxes; + public static int minotaurs; + public static int gaiaConstructs; + public static int minosChampions; + public static int minosInquisitors; + + // Catacombs Dungeons + public static int recombobulators; + public static int fumingPotatoBooks; + // F1 + public static int bonzoStaffs; + public static double f1CoinsSpent; + public static double f1TimeSpent; + // F2 + public static int scarfStudies; + public static int adaptiveSwords; + public static double f2CoinsSpent; + public static double f2TimeSpent; + // F3 + public static int adaptiveHelms; + public static int adaptiveChests; + public static int adaptiveLegs; + public static int adaptiveBoots; + public static double f3CoinsSpent; + public static double f3TimeSpent; + // F4 + public static int spiritWings; + public static int spiritBones; + public static int spiritBoots; + public static int spiritSwords; + public static int spiritBows; + public static int epicSpiritPets; + public static int legSpiritPets; + public static double f4CoinsSpent; + public static double f4TimeSpent; + // F5 + public static int warpedStones; + public static int shadowAssHelms; + public static int shadowAssChests; + public static int shadowAssLegs; + public static int shadowAssBoots; + public static int lastBreaths; + public static int lividDaggers; + public static int shadowFurys; + public static double f5CoinsSpent; + public static double f5TimeSpent; + // F6 + public static int ancientRoses; + public static int precursorEyes; + public static int giantsSwords; + public static int necroLordHelms; + public static int necroLordChests; + public static int necroLordLegs; + public static int necroLordBoots; + public static int necroSwords; + public static double f6CoinsSpent; + public static double f6TimeSpent; + // F7 + public static int witherBloods; + public static int witherCloaks; + public static int implosions; + public static int witherShields; + public static int shadowWarps; + public static int necronsHandles; + public static int autoRecombs; + public static int witherHelms; + public static int witherChests; + public static int witherLegs; + public static int witherBoots; + public static double f7CoinsSpent; + public static double f7TimeSpent; + + // Single sessions (No config saves) + // Wolf + public static int wolfSvensSession = 0; + public static int wolfTeethSession = 0; + public static int wolfWheelsSession = 0; + public static int wolfWheelsDropsSession = 0; + public static int wolfSpiritsSession = 0; + public static int wolfBooksSession = 0; + public static int wolfEggsSession = 0; + public static int wolfCouturesSession = 0; + public static int wolfBaitsSession = 0; + public static int wolfFluxesSession = 0; + public static double wolfTimeSession = -1; + public static int wolfBossesSession = -1; + // Spider + public static int spiderTarantulasSession = 0; + public static int spiderWebsSession = 0; + public static int spiderTAPSession = 0; + public static int spiderTAPDropsSession = 0; + public static int spiderBitesSession = 0; + public static int spiderCatalystsSession = 0; + public static int spiderBooksSession = 0; + public static int spiderSwattersSession = 0; + public static int spiderTalismansSession = 0; + public static int spiderMosquitosSession = 0; + public static double spiderTimeSession = -1; + public static int spiderBossesSession = -1; + // Zombie + public static int zombieRevsSession = 0; + public static int zombieRevFleshSession = 0; + public static int zombieFoulFleshSession = 0; + public static int zombieFoulFleshDropsSession = 0; + public static int zombiePestilencesSession = 0; + public static int zombieUndeadCatasSession = 0; + public static int zombieBooksSession = 0; + public static int zombieBeheadedsSession = 0; + public static int zombieRevCatasSession = 0; + public static int zombieSnakesSession = 0; + public static int zombieScythesSession = 0; + public static double zombieTimeSession = -1; + public static int zombieBossesSession = -1; + + // Fishing + public static int seaCreaturesSession = 0; + public static int goodCatchesSession = 0; + public static int greatCatchesSession = 0; + public static int squidsSession = 0; + public static int seaWalkersSession = 0; + public static int nightSquidsSession = 0; + public static int seaGuardiansSession = 0; + public static int seaWitchesSession = 0; + public static int seaArchersSession = 0; + public static int monsterOfTheDeepsSession = 0; + public static int catfishesSession = 0; + public static int carrotKingsSession = 0; + public static int seaLeechesSession = 0; + public static int guardianDefendersSession = 0; + public static int deepSeaProtectorsSession = 0; + public static int hydrasSession = 0; + public static int seaEmperorsSession = 0; + public static double empTimeSession = -1; + public static int empSCsSession = -1; + public static int fishingMilestoneSession = 0; + // Fishing Winter + public static int frozenStevesSession = 0; + public static int frostyTheSnowmansSession = 0; + public static int grinchesSession = 0; + public static int yetisSession = 0; + public static double yetiTimeSession = -1; + public static int yetiSCsSession = -1; + // Fishing Festival + public static int nurseSharksSession = 0; + public static int blueSharksSession = 0; + public static int tigerSharksSession = 0; + public static int greatWhiteSharksSession = 0; + // Spooky Fishing + public static int scarecrowsSession = 0; + public static int nightmaresSession = 0; + public static int werewolfsSession = 0; + public static int phantomFishersSession = 0; + public static int grimReapersSession = 0; + + // Mythological + public static double mythCoinsSession = 0; + public static int griffinFeathersSession = 0; + public static int crownOfGreedsSession = 0; + public static int washedUpSouvenirsSession = 0; + public static int minosHuntersSession = 0; + public static int siameseLynxesSession = 0; + public static int minotaursSession = 0; + public static int gaiaConstructsSession = 0; + public static int minosChampionsSession = 0; + public static int minosInquisitorsSession = 0; + + // Catacombs Dungeons + public static int recombobulatorsSession = 0; + public static int fumingPotatoBooksSession = 0; + // F1 + public static int bonzoStaffsSession = 0; + public static double f1CoinsSpentSession = 0; + public static double f1TimeSpentSession = 0; + // F2 + public static int scarfStudiesSession = 0; + public static int adaptiveSwordsSession = 0; + public static double f2CoinsSpentSession = 0; + public static double f2TimeSpentSession = 0; + // F3 + public static int adaptiveHelmsSession = 0; + public static int adaptiveChestsSession = 0; + public static int adaptiveLegsSession = 0; + public static int adaptiveBootsSession = 0; + public static double f3CoinsSpentSession = 0; + public static double f3TimeSpentSession = 0; + // F4 + public static int spiritWingsSession = 0; + public static int spiritBonesSession = 0; + public static int spiritBootsSession = 0; + public static int spiritSwordsSession = 0; + public static int spiritBowsSession = 0; + public static int epicSpiritPetsSession = 0; + public static int legSpiritPetsSession = 0; + public static double f4CoinsSpentSession = 0; + public static double f4TimeSpentSession = 0; + // F5 + public static int warpedStonesSession = 0; + public static int shadowAssHelmsSession = 0; + public static int shadowAssChestsSession = 0; + public static int shadowAssLegsSession = 0; + public static int shadowAssBootsSession = 0; + public static int lastBreathsSession = 0; + public static int lividDaggersSession = 0; + public static int shadowFurysSession = 0; + public static double f5CoinsSpentSession = 0; + public static double f5TimeSpentSession = 0; + // F6 + public static int ancientRosesSession = 0; + public static int precursorEyesSession = 0; + public static int giantsSwordsSession = 0; + public static int necroLordHelmsSession = 0; + public static int necroLordChestsSession = 0; + public static int necroLordLegsSession = 0; + public static int necroLordBootsSession = 0; + public static int necroSwordsSession = 0; + public static double f6CoinsSpentSession = 0; + public static double f6TimeSpentSession = 0; + // F7 + public static int witherBloodsSession = 0; + public static int witherCloaksSession = 0; + public static int implosionsSession = 0; + public static int witherShieldsSession = 0; + public static int shadowWarpsSession = 0; + public static int necronsHandlesSession = 0; + public static int autoRecombsSession = 0; + public static int witherHelmsSession = 0; + public static int witherChestsSession = 0; + public static int witherLegsSession = 0; + public static int witherBootsSession = 0; + public static double f7CoinsSpentSession = 0; + public static double f7TimeSpentSession = 0; + + static double checkItemsNow = 0; + static double itemsChecked = 0; + + @SubscribeEvent(priority = EventPriority.HIGHEST) + 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 wolfRNG = false; + boolean spiderRNG = false; + boolean zombieRNG = false; + + // Slayer tracker + // T6 books + if (message.contains("VERY RARE DROP! (Enchanted Book)") || message.contains("CRAZY RARE DROP! (Enchanted Book)")) { + // Loop through scoreboard to see what boss you're doing + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("Sven Packmaster")) { + wolfBooks++; + ConfigHandler.writeIntConfig("wolf", "book", wolfBooks); + } else if (sCleaned.contains("Tarantula Broodfather")) { + spiderBooks++; + ConfigHandler.writeIntConfig("spider", "book", spiderBooks); + } else if (sCleaned.contains("Revenant Horror")) { + zombieBooks++; + ConfigHandler.writeIntConfig("zombie", "book", zombieBooks); + } + } + } + + // Wolf + if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { + wolfSvens++; + wolfSvensSession++; + if (wolfBosses != -1) { + wolfBosses++; + } + if (wolfBossesSession != -1) { + wolfBossesSession++; + } + ConfigHandler.writeIntConfig("wolf", "svens", wolfSvens); + ConfigHandler.writeIntConfig("wolf", "bossRNG", wolfBosses); + } else if (message.contains("RARE DROP! (Hamster Wheel)")) { + wolfWheelsDrops++; + wolfWheelsDropsSession++; + ConfigHandler.writeIntConfig("wolf", "wheelDrops", wolfWheelsDrops); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) { // Removing the unicode here *should* fix rune drops not counting + wolfSpirits++; + wolfSpiritsSession++; + ConfigHandler.writeIntConfig("wolf", "spirit", wolfSpirits); + } else if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { + wolfRNG = true; + wolfEggs++; + wolfEggsSession++; + ConfigHandler.writeIntConfig("wolf", "egg", wolfEggs); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3); + } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) { + wolfRNG = true; + wolfCoutures++; + wolfCouturesSession++; + ConfigHandler.writeIntConfig("wolf", "couture", wolfCoutures); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3); + } else if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { // How did Skyblock devs even manage to make this item Rename Me + wolfRNG = true; + wolfBaits++; + wolfBaitsSession++; + ConfigHandler.writeIntConfig("wolf", "bait", wolfBaits); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "GRIZZLY BAIT!", 3); + } else if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { + wolfRNG = true; + wolfFluxes++; + wolfFluxesSession++; + ConfigHandler.writeIntConfig("wolf", "flux", wolfFluxes); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "OVERFLUX CAPACITOR!", 5); + } else if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { // Spider + spiderTarantulas++; + spiderTarantulasSession++; + if (spiderBosses != -1) { + spiderBosses++; + } + if (spiderBossesSession != -1) { + spiderBossesSession++; + } + ConfigHandler.writeIntConfig("spider", "tarantulas", spiderTarantulas); + ConfigHandler.writeIntConfig("spider", "bossRNG", spiderBosses); + } else if (message.contains("RARE DROP! (Toxic Arrow Poison)")) { + spiderTAPDrops++; + spiderTAPDropsSession++; + ConfigHandler.writeIntConfig("spider", "tapDrops", spiderTAPDrops); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Bite Rune I)")) { + spiderBites++; + spiderBitesSession++; + ConfigHandler.writeIntConfig("spider", "bite", spiderBites); + } else if (message.contains("VERY RARE DROP! (Spider Catalyst)")) { + spiderCatalysts++; + spiderCatalystsSession++; + ConfigHandler.writeIntConfig("spider", "catalyst", spiderCatalysts); + } else if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) { + spiderRNG = true; + spiderSwatters++; + spiderSwattersSession++; + ConfigHandler.writeIntConfig("spider", "swatter", spiderSwatters); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.LIGHT_PURPLE + "FLY SWATTER!", 3); + } else if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { + spiderRNG = true; + spiderTalismans++; + spiderTalismansSession++; + ConfigHandler.writeIntConfig("spider", "talisman", spiderTalismans); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "TARANTULA TALISMAN!", 3); + } else if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { + spiderRNG = true; + spiderMosquitos++; + spiderMosquitosSession++; + ConfigHandler.writeIntConfig("spider", "mosquito", spiderMosquitos); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "DIGESTED MOSQUITO!", 5); + } else if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { // Zombie + zombieRevs++; + zombieRevsSession++; + if (zombieBosses != -1) { + zombieBosses++; + } + if (zombieBossesSession != 1) { + zombieBossesSession++; + } + ConfigHandler.writeIntConfig("zombie", "revs", zombieRevs); + ConfigHandler.writeIntConfig("zombie", "bossRNG", zombieBosses); + } else if (message.contains("RARE DROP! (Foul Flesh)")) { + zombieFoulFleshDrops++; + zombieFoulFleshDropsSession++; + ConfigHandler.writeIntConfig("zombie", "foulFleshDrops", zombieFoulFleshDrops); + } else if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { + zombieRevCatas++; + zombieRevCatasSession++; + ConfigHandler.writeIntConfig("zombie", "revCatalyst", zombieRevCatas); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Pestilence Rune I)")) { + zombiePestilences++; + zombiePestilencesSession++; + ConfigHandler.writeIntConfig("zombie", "pestilence", zombiePestilences); + } else if (message.contains("VERY RARE DROP! (Undead Catalyst)")) { + zombieUndeadCatas++; + zombieUndeadCatasSession++; + ConfigHandler.writeIntConfig("zombie", "undeadCatalyst", zombieUndeadCatas); + } else if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) { + zombieRNG = true; + zombieBeheadeds++; + zombieBeheadedsSession++; + ConfigHandler.writeIntConfig("zombie", "beheaded", zombieBeheadeds); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "BEHEADED HORROR!", 3); + } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Snake Rune I)")) { + zombieRNG = true; + zombieSnakes++; + zombieSnakesSession++; + ConfigHandler.writeIntConfig("zombie", "snake", zombieSnakes); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_GREEN + "SNAKE RUNE!", 3); + } else if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { + zombieRNG = true; + zombieScythes++; + zombieScythesSession++; + ConfigHandler.writeIntConfig("zombie", "scythe", zombieScythes); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SCYTHE BLADE!", 5); + } + + if (wolfRNG) { + wolfTime = System.currentTimeMillis() / 1000; + wolfBosses = 0; + wolfTimeSession = System.currentTimeMillis() / 1000; + wolfBossesSession = 0; + ConfigHandler.writeDoubleConfig("wolf", "timeRNG", wolfTime); + ConfigHandler.writeIntConfig("wolf", "bossRNG", 0); + } + if (spiderRNG) { + spiderTime = System.currentTimeMillis() / 1000; + spiderBosses = 0; + spiderTimeSession = System.currentTimeMillis() / 1000; + spiderBossesSession = 0; + ConfigHandler.writeDoubleConfig("spider", "timeRNG", spiderTime); + ConfigHandler.writeIntConfig("spider", "bossRNG", 0); + } + if (zombieRNG) { + zombieTime = System.currentTimeMillis() / 1000; + zombieBosses = 0; + zombieTimeSession = System.currentTimeMillis() / 1000; + zombieBossesSession = 0; + ConfigHandler.writeDoubleConfig("zombie", "timeRNG", zombieTime); + ConfigHandler.writeIntConfig("zombie", "bossRNG", 0); + } + + // Fishing tracker + if (message.contains("GOOD CATCH!")) { + goodCatches++; + goodCatchesSession++; + ConfigHandler.writeIntConfig("fishing", "goodCatch", goodCatches); + } else if (message.contains("GREAT CATCH!")) { + greatCatches++; + greatCatchesSession++; + ConfigHandler.writeIntConfig("fishing", "greatCatch", greatCatches); + } else if (message.contains("A Squid appeared")) { + squids++; + squidsSession++; + ConfigHandler.writeIntConfig("fishing", "squid", squids); + increaseSeaCreatures(); + } else if (message.contains("You caught a Sea Walker")) { + seaWalkers++; + seaWalkersSession++; + ConfigHandler.writeIntConfig("fishing", "seaWalker", seaWalkers); + increaseSeaCreatures(); + } else if (message.contains("Pitch darkness reveals a Night Squid")) { + nightSquids++; + nightSquidsSession++; + ConfigHandler.writeIntConfig("fishing", "nightSquid", nightSquids); + increaseSeaCreatures(); + } else if (message.contains("You stumbled upon a Sea Guardian")) { + seaGuardians++; + seaGuardiansSession++; + ConfigHandler.writeIntConfig("fishing", "seaGuardian", seaGuardians); + increaseSeaCreatures(); + } else if (message.contains("It looks like you've disrupted the Sea Witch's brewing session. Watch out, she's furious")) { + seaWitches++; + seaWitchesSession++; + ConfigHandler.writeIntConfig("fishing", "seaWitch", seaWitches); + increaseSeaCreatures(); + } else if (message.contains("You reeled in a Sea Archer")) { + seaArchers++; + seaArchersSession++; + ConfigHandler.writeIntConfig("fishing", "seaArcher", seaArchers); + increaseSeaCreatures(); + } else if (message.contains("The Monster of the Deep has emerged")) { + monsterOfTheDeeps++; + monsterOfTheDeepsSession++; + ConfigHandler.writeIntConfig("fishing", "monsterOfDeep", monsterOfTheDeeps); + increaseSeaCreatures(); + } else if (message.contains("Huh? A Catfish")) { + catfishes++; + catfishesSession++; + ConfigHandler.writeIntConfig("fishing", "catfish", catfishes); + increaseSeaCreatures(); + } else if (message.contains("Is this even a fish? It's the Carrot King")) { + carrotKings++; + carrotKingsSession++; + ConfigHandler.writeIntConfig("fishing", "carrotKing", carrotKings); + increaseSeaCreatures(); + } else if (message.contains("Gross! A Sea Leech")) { + seaLeeches++; + seaLeechesSession++; + ConfigHandler.writeIntConfig("fishing", "seaLeech", seaLeeches); + increaseSeaCreatures(); + } else if (message.contains("You've discovered a Guardian Defender of the sea")) { + guardianDefenders++; + guardianDefendersSession++; + ConfigHandler.writeIntConfig("fishing", "guardianDefender", guardianDefenders); + increaseSeaCreatures(); + } else if (message.contains("You have awoken the Deep Sea Protector, prepare for a battle")) { + deepSeaProtectors++; + deepSeaProtectorsSession++; + ConfigHandler.writeIntConfig("fishing", "deepSeaProtector", deepSeaProtectors); + increaseSeaCreatures(); + } else if (message.contains("The Water Hydra has come to test your strength")) { + hydras++; + hydrasSession++; + ConfigHandler.writeIntConfig("fishing", "hydra", hydras); + increaseSeaCreatures(); + } else if (message.contains("The Sea Emperor arises from the depths")) { + increaseSeaCreatures(); + + seaEmperors++; + empTime = System.currentTimeMillis() / 1000; + empSCs = 0; + seaEmperorsSession++; + empTimeSession = System.currentTimeMillis() / 1000; + empSCsSession = 0; + ConfigHandler.writeIntConfig("fishing", "seaEmperor", seaEmperors); + ConfigHandler.writeDoubleConfig("fishing", "empTime", empTime); + ConfigHandler.writeIntConfig("fishing", "empSC", empSCs); + } else if (message.contains("Frozen Steve fell into the pond long ago")) { // Fishing Winter + frozenSteves++; + frozenStevesSession++; + ConfigHandler.writeIntConfig("fishing", "frozenSteve", frozenSteves); + increaseSeaCreatures(); + } else if (message.contains("It's a snowman! He looks harmless")) { + frostyTheSnowmans++; + frostyTheSnowmansSession++; + ConfigHandler.writeIntConfig("fishing", "snowman", frostyTheSnowmans); + increaseSeaCreatures(); + } else if (message.contains("stole Jerry's Gifts...get them back")) { + grinches++; + grinchesSession++; + ConfigHandler.writeIntConfig("fishing", "grinch", grinches); + increaseSeaCreatures(); + } else if (message.contains("What is this creature")) { + yetis++; + yetiTime = System.currentTimeMillis() / 1000; + yetiSCs = 0; + yetisSession++; + yetiTimeSession = System.currentTimeMillis() / 1000; + yetiSCsSession = 0; + ConfigHandler.writeIntConfig("fishing", "yeti", yetis); + ConfigHandler.writeDoubleConfig("fishing", "yetiTime", yetiTime); + ConfigHandler.writeIntConfig("fishing", "yetiSC", yetiSCs); + increaseSeaCreatures(); + } else if (message.contains("A tiny fin emerges from the water, you've caught a Nurse Shark")) { // Fishing Festival + nurseSharks++; + nurseSharksSession++; + ConfigHandler.writeIntConfig("fishing", "nurseShark", nurseSharks); + increaseSeaCreatures(); + } else if (message.contains("You spot a fin as blue as the water it came from, it's a Blue Shark")) { + blueSharks++; + blueSharksSession++; + ConfigHandler.writeIntConfig("fishing", "blueShark", blueSharks); + increaseSeaCreatures(); + } else if (message.contains("A striped beast bounds from the depths, the wild Tiger Shark")) { + tigerSharks++; + tigerSharksSession++; + ConfigHandler.writeIntConfig("fishing", "tigerShark", tigerSharks); + increaseSeaCreatures(); + } else if (message.contains("Hide no longer, a Great White Shark has tracked your scent and thirsts for your blood")) { + greatWhiteSharks++; + greatWhiteSharksSession++; + ConfigHandler.writeIntConfig("fishing", "greatWhiteShark", greatWhiteSharks); + increaseSeaCreatures(); + } else if (message.contains("Phew! It's only a Scarecrow")) { + scarecrows++; + scarecrowsSession++; + ConfigHandler.writeIntConfig("fishing", "scarecrow", scarecrows); + increaseSeaCreatures(); + } else if (message.contains("You hear trotting from beneath the waves, you caught a Nightmare")) { + nightmares++; + nightmaresSession++; + ConfigHandler.writeIntConfig("fishing", "nightmare", nightmares); + increaseSeaCreatures(); + } else if (message.contains("It must be a full moon, a Werewolf appears")) { + werewolfs++; + werewolfsSession++; + ConfigHandler.writeIntConfig("fishing", "werewolf", werewolfs); + increaseSeaCreatures(); + } else if (message.contains("The spirit of a long lost Phantom Fisher has come to haunt you")) { + phantomFishers++; + phantomFishersSession++; + ConfigHandler.writeIntConfig("fishing", "phantomFisher", phantomFishers); + increaseSeaCreatures(); + } else if (message.contains("This can't be! The manifestation of death himself")) { + grimReapers++; + grimReapersSession++; + ConfigHandler.writeIntConfig("fishing", "grimReaper", grimReapers); + increaseSeaCreatures(); + } + + // Dungeons tracker + if (message.contains(" ")) { + if (message.contains("Recombobulator 3000")) { + recombobulators++; + recombobulatorsSession++; + ConfigHandler.writeIntConfig("catacombs", "recombobulator", recombobulators); + } else if (message.contains("Fuming Potato Book")) { + fumingPotatoBooks++; + fumingPotatoBooksSession++; + ConfigHandler.writeIntConfig("catacombs", "fumingBooks", fumingPotatoBooks); + } else if (message.contains("Bonzo's Staff")) { // F1 + bonzoStaffs++; + bonzoStaffsSession++; + ConfigHandler.writeIntConfig("catacombs", "bonzoStaff", bonzoStaffs); + } else if (message.contains("Scarf's Studies")) { // F2 + scarfStudies++; + scarfStudiesSession++; + ConfigHandler.writeIntConfig("catacombs", "scarfStudies", scarfStudies); + } else if (message.contains("Adaptive Helmet")) { // F3 + adaptiveHelms++; + adaptiveHelmsSession++; + ConfigHandler.writeIntConfig("catacombs", "adaptiveHelm", adaptiveHelms); + } else if (message.contains("Adaptive Chestplate")) { + adaptiveChests++; + adaptiveChestsSession++; + ConfigHandler.writeIntConfig("catacombs", "adaptiveChest", adaptiveChests); + } else if (message.contains("Adaptive Leggings")) { + adaptiveLegs++; + adaptiveLegsSession++; + ConfigHandler.writeIntConfig("catacombs", "adaptiveLegging", adaptiveLegs); + } else if (message.contains("Adaptive Boots")) { + adaptiveBoots++; + adaptiveBootsSession++; + ConfigHandler.writeIntConfig("catacombs", "adaptiveBoot", adaptiveBoots); + } else if (message.contains("Adaptive Blade")) { + adaptiveSwords++; + adaptiveSwordsSession++; + ConfigHandler.writeIntConfig("catacombs", "adaptiveSword", adaptiveSwords); + } else if (message.contains("Spirit Wing")) { // F4 + spiritWings++; + spiritWingsSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritWing", spiritWings); + } else if (message.contains("Spirit Bone")) { + spiritBones++; + spiritBonesSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritBone", spiritBones); + } else if (message.contains("Spirit Boots")) { + spiritBoots++; + spiritBootsSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritBoot", spiritBoots); + } else if (message.contains("[Lvl 1] Spirit")) { + String formattedMessage = event.message.getFormattedText(); + // Unicode colour code messes up here, just gonna remove the symbols + if (formattedMessage.contains("5Spirit")) { + epicSpiritPets++; + epicSpiritPetsSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritPetEpic", epicSpiritPets); + } else if (formattedMessage.contains("6Spirit")) { + legSpiritPets++; + legSpiritPetsSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritPetLeg", legSpiritPets); + } + } else if (message.contains("Spirit Sword")) { + spiritSwords++; + spiritSwordsSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritSword", spiritSwords); + } else if (message.contains("Spirit Bow")) { + spiritBows++; + spiritBowsSession++; + ConfigHandler.writeIntConfig("catacombs", "spiritBow", spiritBows); + } else if (message.contains("Warped Stone")) { // F5 + warpedStones++; + warpedStonesSession++; + ConfigHandler.writeIntConfig("catacombs", "warpedStone", warpedStones); + } else if (message.contains("Shadow Assassin Helmet")) { + shadowAssHelms++; + shadowAssHelmsSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowAssassinHelm", shadowAssHelms); + } else if (message.contains("Shadow Assassin Chestplate")) { + shadowAssChests++; + shadowAssChestsSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowAssassinChest", shadowAssChests); + } else if (message.contains("Shadow Assassin Leggings")) { + shadowAssLegs++; + shadowAssLegsSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowAssassinLegging", shadowAssLegs); + } else if (message.contains("Shadow Assassin Boots")) { + shadowAssBoots++; + shadowAssBootsSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowAssassinBoot", shadowAssBoots); + } else if (message.contains("Livid Dagger")) { + lividDaggers++; + lividDaggersSession++; + ConfigHandler.writeIntConfig("catacombs", "lividDagger", lividDaggers); + } else if (message.contains("Shadow Fury")) { + shadowFurys++; + shadowFurysSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowFury", shadowFurys); + } else if (message.contains("Ancient Rose")) { // F6 + ancientRoses++; + ancientRosesSession++; + ConfigHandler.writeIntConfig("catacombs", "ancientRose", ancientRoses); + } else if (message.contains("Precursor Eye")) { + precursorEyes++; + precursorEyesSession++; + ConfigHandler.writeIntConfig("catacombs", "precursorEye", precursorEyes); + } else if (message.contains("Giant's Sword")) { + giantsSwords++; + giantsSwordsSession++; + ConfigHandler.writeIntConfig("catacombs", "giantsSword", giantsSwords); + } else if (message.contains("Necromancer Lord Helmet")) { + necroLordHelms++; + necroLordHelmsSession++; + ConfigHandler.writeIntConfig("catacombs", "necroLordHelm", necroLordHelms); + } else if (message.contains("Necromancer Lord Chestplate")) { + necroLordChests++; + necroLordChestsSession++; + ConfigHandler.writeIntConfig("catacombs", "necroLordChest", necroLordChests); + } else if (message.contains("Necromancer Lord Leggings")) { + necroLordLegs++; + necroLordLegsSession++; + ConfigHandler.writeIntConfig("catacombs", "necroLordLegging", necroLordLegs); + } else if (message.contains("Necromancer Lord Boots")) { + necroLordBoots++; + necroLordBootsSession++; + ConfigHandler.writeIntConfig("catacombs", "necroLordBoot", necroLordBoots); + } else if (message.contains("Necromancer Sword")) { + necroSwords++; + necroSwordsSession++; + ConfigHandler.writeIntConfig("catacombs", "necroSword", necroSwords); + } else if (message.contains("Wither Blood")) { // F7 + witherBloods++; + witherBloodsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherBlood", witherBloods); + } else if (message.contains("Wither Cloak")) { + witherCloaks++; + witherCloaksSession++; + ConfigHandler.writeIntConfig("catacombs", "witherCloak", witherCloaks); + } else if (message.contains("Implosion")) { + implosions++; + implosionsSession++; + ConfigHandler.writeIntConfig("catacombs", "implosion", implosions); + } else if (message.contains("Wither Shield")) { + witherShields++; + witherShieldsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherShield", witherShields); + } else if (message.contains("Shadow Warp")) { + shadowWarps++; + shadowWarpsSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowWarp", shadowWarps); + } else if (message.contains("Necron's Handle")) { + necronsHandles++; + necronsHandlesSession++; + ConfigHandler.writeIntConfig("catacombs", "necronsHandle", necronsHandles); + } else if (message.contains("Auto Recombobulator")) { + autoRecombs++; + autoRecombsSession++; + ConfigHandler.writeIntConfig("catacombs", "autoRecomb", autoRecombs); + } else if (message.contains("Wither Helmet")) { + witherHelms++; + witherHelmsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherHelm", witherHelms); + } else if (message.contains("Wither Chestplate")) { + witherChests++; + witherChestsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherChest", witherChests); + } else if (message.contains("Wither Leggings")) { + witherLegs++; + witherLegsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherLegging", witherLegs); + } else if (message.contains("Wither Boots")) { + witherBoots++; + witherBootsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherBoot", witherBoots); + } + } + + if (message.contains("EXTRA STATS ")) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + int timeToAdd = 0; + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (")) { + // Add time to floor + if (sCleaned.contains("F1")) { + f1TimeSpent = Math.floor(f1TimeSpent + timeToAdd); + f1TimeSpentSession = Math.floor(f1TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorOneTime", f1TimeSpent); + } else if (sCleaned.contains("F2")) { + f2TimeSpent = Math.floor(f2TimeSpent + timeToAdd); + f2TimeSpentSession = Math.floor(f2TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorTwoTime", f2TimeSpent); + } else if (sCleaned.contains("F3")) { + f3TimeSpent = Math.floor(f3TimeSpent + timeToAdd); + f3TimeSpentSession = Math.floor(f3TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorThreeTime", f3TimeSpent); + } else if (sCleaned.contains("F4")) { + f4TimeSpent = Math.floor(f4TimeSpent + timeToAdd); + f4TimeSpentSession = Math.floor(f4TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorFourTime", f4TimeSpent); + } else if (sCleaned.contains("F5")) { + f5TimeSpent = Math.floor(f5TimeSpent + timeToAdd); + f5TimeSpentSession = Math.floor(f5TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorFiveTime", f5TimeSpent); + } else if (sCleaned.contains("F6")) { + f6TimeSpent = Math.floor(f6TimeSpent + timeToAdd); + f6TimeSpentSession = Math.floor(f6TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorSixTime", f6TimeSpent); + } else if (sCleaned.contains("F7")) { + f7TimeSpent = Math.floor(f7TimeSpent + timeToAdd); + f7TimeSpentSession = Math.floor(f7TimeSpentSession + timeToAdd); + ConfigHandler.writeDoubleConfig("catacombs", "floorSevenTime", f7TimeSpent); + } + } else if (sCleaned.contains("Time Elapsed:")) { + // Get floor time + String time = sCleaned.substring(sCleaned.indexOf(":") + 2); + time = time.replaceAll("\\s", ""); + int minutes = Integer.parseInt(time.substring(0, time.indexOf("m"))); + int seconds = Integer.parseInt(time.substring(time.indexOf("m") + 1, time.indexOf("s"))); + timeToAdd = (minutes * 60) + seconds; + } + } + } + + // Mythological Tracker + if (message.contains("You dug out")) { + if (message.contains(" coins!")) { + double coinsEarned = Double.parseDouble(message.replaceAll("[^\\d]", "")); + mythCoins += coinsEarned; + mythCoinsSession += coinsEarned; + ConfigHandler.writeDoubleConfig("mythological", "coins", mythCoins); + } else if (message.contains("a Griffin Feather!")) { + griffinFeathers++; + griffinFeathersSession++; + ConfigHandler.writeIntConfig("mythological", "griffinFeather", griffinFeathers); + } else if (message.contains("a Crown of Greed!")) { + crownOfGreeds++; + crownOfGreedsSession++; + ConfigHandler.writeIntConfig("mythological", "crownOfGreed", crownOfGreeds); + } else if (message.contains("a Washed-up Souvenir!")) { + washedUpSouvenirs++; + washedUpSouvenirsSession++; + ConfigHandler.writeIntConfig("mythological", "washedUpSouvenir", washedUpSouvenirs); + } else if (message.contains("a Minos Hunter!")) { + minosHunters++; + minosHuntersSession++; + ConfigHandler.writeIntConfig("mythological", "minosHunter", minosHunters); + } else if (message.contains("Siamese Lynxes!")) { + siameseLynxes++; + siameseLynxesSession++; + ConfigHandler.writeIntConfig("mythological", "siameseLynx", siameseLynxes); + } else if (message.contains("a Minotaur!")) { + minotaurs++; + minotaursSession++; + ConfigHandler.writeIntConfig("mythological", "minotaur", minotaurs); + } else if (message.contains("a Gaia Construct!")) { + gaiaConstructs++; + gaiaConstructsSession++; + ConfigHandler.writeIntConfig("mythological", "gaiaConstruct", gaiaConstructs); + } else if (message.contains("a Minos Champion!")) { + minosChampions++; + minosChampionsSession++; + ConfigHandler.writeIntConfig("mythological", "minosChampion", minosChampions); + } else if (message.contains("a Minos Inquisitor!")) { + minosInquisitors++; + minosInquisitorsSession++; + ConfigHandler.writeIntConfig("mythological", "minosInquisitor", minosInquisitors); + } + } + } + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + ItemStack item = event.item; + + if (event.inventoryName.endsWith(" Chest") && item != null && item.getDisplayName().contains("Open Reward Chest")) { + List tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + for (String lineUnclean : tooltip) { + String line = StringUtils.stripControlCodes(lineUnclean); + if (line.contains("FREE")) { + break; + } else if (line.contains(" Coins")) { + int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", "")); + + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (")) { + if (sCleaned.contains("F1")) { + f1CoinsSpent += coinsSpent; + f1CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorOneCoins", f1CoinsSpent); + } else if (sCleaned.contains("F2")) { + f2CoinsSpent += coinsSpent; + f2CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorTwoCoins", f2CoinsSpent); + } else if (sCleaned.contains("F3")) { + f3CoinsSpent += coinsSpent; + f3CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorThreeCoins", f3CoinsSpent); + } else if (sCleaned.contains("F4")) { + f4CoinsSpent += coinsSpent; + f4CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorFourCoins", f4CoinsSpent); + } else if (sCleaned.contains("F5")) { + f5CoinsSpent += coinsSpent; + f5CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorFiveCoins", f5CoinsSpent); + } else if (sCleaned.contains("F6")) { + f6CoinsSpent += coinsSpent; + f6CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorSixCoins", f6CoinsSpent); + } else if (sCleaned.contains("F7")) { + f7CoinsSpent += coinsSpent; + f7CoinsSpentSession += coinsSpent; + ConfigHandler.writeDoubleConfig("catacombs", "floorSevenCoins", f7CoinsSpent); + } + break; + } + } + break; + } + } + } + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onSound(PlaySoundEvent event) { + if (!Utils.inSkyblock) return; + if (event.name.equals("note.pling")) { + // Don't check twice within 3 seconds + checkItemsNow = System.currentTimeMillis() / 1000; + if (checkItemsNow - itemsChecked < 3) return; + + List scoreboard = ScoreboardHandler.getSidebarLines(); + + for (String line : scoreboard) { + String cleanedLine = ScoreboardHandler.cleanSB(line); + // If Hypixel lags and scoreboard doesn't update + if (cleanedLine.contains("Boss slain!") || cleanedLine.contains("Slay the boss!")) { + int itemTeeth = Utils.getItems("Wolf Tooth"); + int itemWheels = Utils.getItems("Hamster Wheel"); + int itemWebs = Utils.getItems("Tarantula Web"); + int itemTAP = Utils.getItems("Toxic Arrow Poison"); + int itemRev = Utils.getItems("Revenant Flesh"); + int itemFoul = Utils.getItems("Foul Flesh"); + + // If no items, are detected, allow check again. Should fix items not being found + if (itemTeeth + itemWheels + itemWebs + itemTAP + itemRev + itemFoul > 0) { + itemsChecked = System.currentTimeMillis() / 1000; + wolfTeeth += itemTeeth; + wolfWheels += itemWheels; + spiderWebs += itemWebs; + spiderTAP += itemTAP; + zombieRevFlesh += itemRev; + zombieFoulFlesh += itemFoul; + wolfTeethSession += itemTeeth; + wolfWheelsSession += itemWheels; + spiderWebsSession += itemWebs; + spiderTAPSession += itemTAP; + zombieRevFleshSession += itemRev; + zombieFoulFleshSession += itemFoul; + + ConfigHandler.writeIntConfig("wolf", "teeth", wolfTeeth); + ConfigHandler.writeIntConfig("wolf", "wheel", wolfWheels); + ConfigHandler.writeIntConfig("spider", "web", spiderWebs); + ConfigHandler.writeIntConfig("spider", "tap", spiderTAP); + ConfigHandler.writeIntConfig("zombie", "revFlesh", zombieRevFlesh); + ConfigHandler.writeIntConfig("zombie", "foulFlesh", zombieFoulFlesh); + } + } + } + } + } + + public void increaseSeaCreatures() { + if (empSCs != -1) { + empSCs++; + } + if (empSCsSession != -1) { + empSCsSession++; + } + // Only increment Yetis when in Jerry's Workshop + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("Jerry's Workshop") || sCleaned.contains("Jerry Pond")) { + if (yetiSCs != -1) { + yetiSCs++; + } + if (yetiSCsSession != -1) { + yetiSCsSession++; + } + } + } + + seaCreatures++; + fishingMilestone++; + seaCreaturesSession++; + fishingMilestoneSession++; + ConfigHandler.writeIntConfig("fishing", "seaCreature", seaCreatures); + ConfigHandler.writeIntConfig("fishing", "milestone", fishingMilestone); + ConfigHandler.writeIntConfig("fishing", "empSC", empSCs); + ConfigHandler.writeIntConfig("fishing", "yetiSC", yetiSCs); + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java new file mode 100644 index 0000000..35458f3 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java @@ -0,0 +1,32 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraftforge.event.entity.player.EntityInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class ArrowTerminalSolver { + + @SubscribeEvent + public void onEntityInteract(EntityInteractEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + if (mc.thePlayer != event.entityPlayer) return; + + if (ToggleCommand.itemFrameOnSeaLanternsToggled && Utils.inDungeons && event.target instanceof EntityItemFrame) { + EntityItemFrame itemFrame = (EntityItemFrame) event.target; + ItemStack item = itemFrame.getDisplayedItem(); + if (item == null || item.getItem() != Items.arrow) return; + BlockPos blockPos = Utils.getBlockUnderItemFrame(itemFrame); + if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { + event.setCanceled(true); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java new file mode 100644 index 0000000..0910fc7 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java @@ -0,0 +1,86 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class BlazeSolver { + + static Entity highestBlaze = null; + static Entity lowestBlaze = null; + public static int LOWEST_BLAZE_COLOUR; + public static int HIGHEST_BLAZE_COLOUR; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + lowestBlaze = null; + highestBlaze = null; + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 4 == 0) { + if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { + List entities = world.getLoadedEntityList(); + int highestHealth = 0; + highestBlaze = null; + int lowestHealth = 99999999; + lowestBlaze = null; + + for (Entity entity : entities) { + if (entity.getName().contains("Blaze") && entity.getName().contains("/")) { + String blazeName = StringUtils.stripControlCodes(entity.getName()); + try { + int health = Integer.parseInt(blazeName.substring(blazeName.indexOf("/") + 1, blazeName.length() - 1)); + if (health > highestHealth) { + highestHealth = health; + highestBlaze = entity; + } + if (health < lowestHealth) { + lowestHealth = health; + lowestBlaze = entity; + } + } catch (NumberFormatException ex) { + ex.printStackTrace(); + } + } + } + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.blazeToggled && Utils.inDungeons) { + if (lowestBlaze != null) { + BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); + Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Smallest", LOWEST_BLAZE_COLOUR, event.partialTicks); + AxisAlignedBB aabb = new AxisAlignedBB(lowestBlaze.posX - 0.5, lowestBlaze.posY - 2, lowestBlaze.posZ - 0.5, lowestBlaze.posX + 0.5, lowestBlaze.posY, lowestBlaze.posZ + 0.5); + Utils.draw3DBox(aabb, LOWEST_BLAZE_COLOUR, event.partialTicks); + } + if (highestBlaze != null) { + BlockPos stringPos = new BlockPos(highestBlaze.posX, highestBlaze.posY + 1, highestBlaze.posZ); + Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Biggest", HIGHEST_BLAZE_COLOUR, event.partialTicks); + AxisAlignedBB aabb = new AxisAlignedBB(highestBlaze.posX - 0.5, highestBlaze.posY - 2, highestBlaze.posZ - 0.5, highestBlaze.posX + 0.5, highestBlaze.posY, highestBlaze.posZ + 0.5); + Utils.draw3DBox(aabb, HIGHEST_BLAZE_COLOUR, event.partialTicks); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java new file mode 100644 index 0000000..464b76a --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java @@ -0,0 +1,84 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.Arrays; + +public class BlockAbilities { + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + ItemStack item = event.entityPlayer.getHeldItem(); + if (item == null) return; + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { + event.setCanceled(true); + } + if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { + event.setCanceled(true); + } + } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + + ArrayList interactables = new ArrayList<>(Arrays.asList( + Blocks.acacia_door, + Blocks.anvil, + Blocks.beacon, + Blocks.bed, + Blocks.birch_door, + Blocks.brewing_stand, + Blocks.command_block, + Blocks.crafting_table, + Blocks.chest, + Blocks.dark_oak_door, + Blocks.daylight_detector, + Blocks.daylight_detector_inverted, + Blocks.dispenser, + Blocks.dropper, + Blocks.enchanting_table, + Blocks.ender_chest, + Blocks.furnace, + Blocks.hopper, + Blocks.jungle_door, + Blocks.lever, + Blocks.noteblock, + Blocks.powered_comparator, + Blocks.unpowered_comparator, + Blocks.powered_repeater, + Blocks.unpowered_repeater, + Blocks.standing_sign, + Blocks.wall_sign, + Blocks.trapdoor, + Blocks.trapped_chest, + Blocks.wooden_button, + Blocks.stone_button, + Blocks.oak_door, + Blocks.skull + )); + if (Utils.inDungeons) { + interactables.add(Blocks.coal_block); + interactables.add(Blocks.stained_hardened_clay); + } + + if (!interactables.contains(block)) { + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { + event.setCanceled(true); + } + if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { + event.setCanceled(true); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java new file mode 100644 index 0000000..fe89fef --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java @@ -0,0 +1,44 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.Arrays; + +public class BlockPlacingFlowers { + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + ItemStack item = event.entityPlayer.getHeldItem(); + if (item == null) return; + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + + ArrayList flowerPlaceable = new ArrayList<>(Arrays.asList( + Blocks.grass, + Blocks.dirt, + Blocks.flower_pot, + Blocks.tallgrass, + Blocks.double_plant + )); + if (flowerPlaceable.contains(block)) { + if (ToggleCommand.flowerWeaponsToggled && item.getDisplayName().contains("Flower of Truth")) { + event.setCanceled(true); + } + if (ToggleCommand.flowerWeaponsToggled && item.getDisplayName().contains("Spirit Sceptre")) { + event.setCanceled(true); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java new file mode 100644 index 0000000..e967623 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java @@ -0,0 +1,112 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.utils.Utils; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.input.Keyboard; + +public class BlockWrongTerminalClicks { + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + if (ToggleCommand.blockWrongTerminalClicksToggled && Utils.inDungeons) { + IInventory inventory = event.inventory; + String inventoryName = event.inventoryName; + Slot slot = event.slot; + ItemStack item = event.item; + boolean shouldCancel = false; + + if (item == null) return; + + //most of these are extra but who cares + + switch (inventoryName) { + case "Correct all the panes!": + shouldCancel = !StringUtils.stripControlCodes(item.getDisplayName()).startsWith("Off"); + break; + case "Navigate the maze!": + if (item.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) { + shouldCancel = true; + break; + } + + if (item.getItemDamage() != 0) { + shouldCancel = true; + break; + } + + boolean isValid = false; + + int slotIndex = slot.getSlotIndex(); + + if (slotIndex % 9 != 8 && slotIndex != 53) { + ItemStack itemStack = inventory.getStackInSlot(slotIndex + 1); + if (itemStack != null && itemStack.getItemDamage() == 5) isValid = true; + } + + if (!isValid && slotIndex % 9 != 0 && slotIndex != 0) { + ItemStack itemStack = inventory.getStackInSlot(slotIndex - 1); + if (itemStack != null && itemStack.getItemDamage() == 5) isValid = true; + } + + if (!isValid && slotIndex <= 44) { + ItemStack itemStack = inventory.getStackInSlot(slotIndex + 9); + if (itemStack != null && itemStack.getItemDamage() == 5) isValid = true; + } + + if (!isValid && slotIndex >= 9) { + ItemStack itemStack = inventory.getStackInSlot(slotIndex - 9); + if (itemStack != null && itemStack.getItemDamage() == 5) isValid = true; + } + + shouldCancel = !isValid; + + break; + case "Click in order!": + + if (slot.getSlotIndex() > 35) { + break; + } + + if ((item.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane))) { + shouldCancel = true; + break; + } + if (item.getItemDamage() != 14) { + shouldCancel = true; + break; + } + int needed = ClickInOrderSolver.terminalNumberNeeded[0]; + if (needed == 0) break; + shouldCancel = needed != -1 && item.stackSize != needed; + break; + } + + if (!shouldCancel) { + if (inventoryName.startsWith("What starts with:")) { + char letter = inventoryName.charAt(inventoryName.indexOf("'") + 1); + shouldCancel = !(StringUtils.stripControlCodes(item.getDisplayName()).charAt(0) == letter); + } else if (inventoryName.startsWith("Select all the")) { + if (SelectAllColourSolver.terminalColorNeeded == null) return; + String itemName = StringUtils.stripControlCodes(item.getDisplayName()).toUpperCase(); + shouldCancel = !(itemName.contains(SelectAllColourSolver.terminalColorNeeded) || + (SelectAllColourSolver.terminalColorNeeded.equals("SILVER") && itemName.contains("LIGHT GRAY")) || + (SelectAllColourSolver.terminalColorNeeded.equals("WHITE") && (itemName.equals("WOOL") || itemName.equals("BONE MEAL"))) || + (SelectAllColourSolver.terminalColorNeeded.equals("BLACK") && itemName.equals("INK SACK")) || + (SelectAllColourSolver.terminalColorNeeded.equals("BLUE") && itemName.equals("LAPIS LAZULI")) || + (SelectAllColourSolver.terminalColorNeeded.equals("BROWN") && itemName.equals("COCOA BEANS"))); + } + } + + event.setCanceled(shouldCancel && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)); + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ChronomatronSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ChronomatronSolver.java new file mode 100644 index 0000000..7bbd25a --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/ChronomatronSolver.java @@ -0,0 +1,114 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; +import java.util.List; + +public class ChronomatronSolver { + + static int lastChronomatronRound = 0; + static List chronomatronPattern = new ArrayList<>(); + static int chronomatronMouseClicks = 0; + public static int CHRONOMATRON_NEXT; + public static int CHRONOMATRON_NEXT_TO_NEXT; + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + if (ToggleCommand.chronomatronToggled && event.inventoryName.startsWith("Chronomatron (")) { + IInventory inventory = event.inventory; + ItemStack item = event.item; + if (item == null) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) + event.setCanceled(true); + return; + } + if (inventory.getStackInSlot(49).getDisplayName().startsWith("§7Timer: §a") && (item.getItem() == Item.getItemFromBlock(Blocks.stained_glass) || item.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay))) { + if (chronomatronPattern.size() > chronomatronMouseClicks && !item.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) + event.setCanceled(true); + return; + } + chronomatronMouseClicks++; + } else if (inventory.getStackInSlot(49).getDisplayName().startsWith("§aRemember the pattern!")) { + if (event.isCancelable()) event.setCanceled(true); + } + } + } + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + if (ToggleCommand.chronomatronToggled && event.displayName.startsWith("Chronomatron (")) { + int chestSize = event.chestSize; + List invSlots = event.slots; + if (invSlots.size() > 48 && invSlots.get(49).getStack() != null) { + if (invSlots.get(49).getStack().getDisplayName().startsWith("§7Timer: §a") && invSlots.get(4).getStack() != null) { + int round = invSlots.get(4).getStack().stackSize; + int timerSeconds = Integer.parseInt(StringUtils.stripControlCodes(invSlots.get(49).getStack().getDisplayName()).replaceAll("[^\\d]", "")); + if (round != lastChronomatronRound && timerSeconds == round + 2) { + lastChronomatronRound = round; + for (int i = 10; i <= 43; i++) { + ItemStack stack = invSlots.get(i).getStack(); + if (stack == null) continue; + if (stack.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay)) { + chronomatronPattern.add(stack.getDisplayName()); + break; + } + } + } + if (chronomatronMouseClicks < chronomatronPattern.size()) { + for (int i = 10; i <= 43; i++) { + ItemStack glass = invSlots.get(i).getStack(); + if (glass == null) continue; + + Slot glassSlot = invSlots.get(i); + + if (chronomatronMouseClicks + 1 < chronomatronPattern.size()) { + if (chronomatronPattern.get(chronomatronMouseClicks).equals(chronomatronPattern.get(chronomatronMouseClicks + 1))) { + if (glass.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) { + Utils.drawOnSlot(chestSize, glassSlot.xDisplayPosition, glassSlot.yDisplayPosition, CHRONOMATRON_NEXT + 0xE5000000); + } + } else if (glass.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) { + Utils.drawOnSlot(chestSize, glassSlot.xDisplayPosition, glassSlot.yDisplayPosition, CHRONOMATRON_NEXT + 0xE5000000); + } else if (glass.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks + 1))) { + Utils.drawOnSlot(chestSize, glassSlot.xDisplayPosition, glassSlot.yDisplayPosition, CHRONOMATRON_NEXT_TO_NEXT + 0XBE000000); + } + } else if (glass.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) { + Utils.drawOnSlot(chestSize, glassSlot.xDisplayPosition, glassSlot.yDisplayPosition, CHRONOMATRON_NEXT + 0xE5000000); + } + } + } + } else if (invSlots.get(49).getStack().getDisplayName().equals("§aRemember the pattern!")) { + chronomatronMouseClicks = 0; + } + } + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution sr = new ScaledResolution(mc); + int guiLeft = (sr.getScaledWidth() - 176) / 2; + new TextRenderer(mc, String.join("\n", chronomatronPattern), (int) (guiLeft * 0.8), 10, 1); + } + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + lastChronomatronRound = 0; + chronomatronPattern.clear(); + chronomatronMouseClicks = 0; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ClickInOrderSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ClickInOrderSolver.java new file mode 100644 index 0000000..e503b37 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/ClickInOrderSolver.java @@ -0,0 +1,107 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class ClickInOrderSolver { + + static Slot[] clickInOrderSlots = new Slot[36]; + static int[] terminalNumberNeeded = new int[4]; + public static int CLICK_IN_ORDER_NEXT; + public static int CLICK_IN_ORDER_NEXT_TO_NEXT; + + @SubscribeEvent(priority = EventPriority.LOW) + public void onTooltipLow(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + + if (mc.currentScreen instanceof GuiChest) { + ContainerChest chest = (ContainerChest) player.openContainer; + IInventory inv = chest.getLowerChestInventory(); + String chestName = inv.getDisplayName().getUnformattedText(); + + if (ToggleCommand.clickInOrderToggled && chestName.equals("Click in order!")) { + event.toolTip.clear(); + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + if (mc.currentScreen instanceof GuiChest) { + if (player == null) return; + ContainerChest chest = (ContainerChest) player.openContainer; + List invSlots = ((GuiChest) mc.currentScreen).inventorySlots.inventorySlots; + String chestName = chest.getLowerChestInventory().getDisplayName().getUnformattedText().trim(); + + if (ToggleCommand.clickInOrderToggled && chestName.equals("Click in order!")) { + if (terminalNumberNeeded[0] == 0) terminalNumberNeeded[0] = 15; + if (terminalNumberNeeded[2] == 0) terminalNumberNeeded[2] = 15; + for (int i = 10; i <= 25; i++) { + if (i == 17 || i == 18) continue; + ItemStack prevStack = invSlots.get(terminalNumberNeeded[1]).getStack(); + if (prevStack == null) terminalNumberNeeded[0] = 15; + else if (prevStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) + terminalNumberNeeded[0] = 15; + else if (prevStack.getItemDamage() == 5) terminalNumberNeeded[0] = 15; + + ItemStack itemStack = invSlots.get(i).getStack(); + if (itemStack == null) continue; + if (itemStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) continue; + if (itemStack.getItemDamage() != 14) continue; + if (itemStack.stackSize < terminalNumberNeeded[0]) { + terminalNumberNeeded[0] = itemStack.stackSize; + terminalNumberNeeded[1] = i; + } else if (itemStack.stackSize == terminalNumberNeeded[0] + 1) { + terminalNumberNeeded[2] = itemStack.stackSize; + terminalNumberNeeded[3] = i; + } + } + } + } + } + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + if (ToggleCommand.clickInOrderToggled && event.displayName.equals("Click in order!")) { + int chestSize = event.chestSize; + List invSlots = event.slots; + Slot slot = invSlots.get(terminalNumberNeeded[1]); + Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, CLICK_IN_ORDER_NEXT + 0xFF000000); + Slot nextSlot = invSlots.get(terminalNumberNeeded[3]); + if (nextSlot != slot && nextSlot.getSlotIndex() != 0) { + Utils.drawOnSlot(chestSize, nextSlot.xDisplayPosition, nextSlot.yDisplayPosition, CLICK_IN_ORDER_NEXT_TO_NEXT + 0xFF000000); + } + } + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + terminalNumberNeeded = new int[4]; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java new file mode 100644 index 0000000..8c7132c --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java @@ -0,0 +1,86 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; + +public class CreeperSolver { + + // Among Us colours + static final int[] CREEPER_COLOURS = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; + static boolean drawCreeperLines = false; + static Vec3 creeperLocation = new Vec3(0, 0, 0); + static List creeperLines = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + World world = mc.theWorld; + EntityPlayerSP player = mc.thePlayer; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.creeperToggled && Utils.inDungeons && world != null && player != null) { + double x = player.posX; + double y = player.posY; + double z = player.posZ; + // Find creepers nearby + AxisAlignedBB creeperScan = new AxisAlignedBB(x - 14, y - 8, z - 13, x + 14, y + 8, z + 13); // 28x16x26 cube + List creepers = world.getEntitiesWithinAABB(EntityCreeper.class, creeperScan); + // Check if creeper is nearby + if (creepers.size() > 0 && !creepers.get(0).isInvisible()) { // Don't show Wither Cloak creepers + EntityCreeper creeper = creepers.get(0); + // Start creeper line drawings + creeperLines.clear(); + if (!drawCreeperLines) creeperLocation = new Vec3(creeper.posX, creeper.posY + 1, creeper.posZ); + drawCreeperLines = true; + // Search for nearby sea lanterns and prismarine blocks + BlockPos point1 = new BlockPos(creeper.posX - 14, creeper.posY - 7, creeper.posZ - 13); + BlockPos point2 = new BlockPos(creeper.posX + 14, creeper.posY + 10, creeper.posZ + 13); + Iterable blocks = BlockPos.getAllInBox(point1, point2); + for (BlockPos blockPos : blocks) { + Block block = world.getBlockState(blockPos).getBlock(); + if (block == Blocks.sea_lantern || block == Blocks.prismarine) { + // Connect block to nearest block on opposite side + Vec3 startBlock = new Vec3(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5); + BlockPos oppositeBlock = Utils.getFirstBlockPosAfterVectors(mc, startBlock, creeperLocation, 10, 20); + BlockPos endBlock = Utils.getNearbyBlock(mc, oppositeBlock, Blocks.sea_lantern, Blocks.prismarine); + if (endBlock != null && startBlock.yCoord > 68 && endBlock.getY() > 68) { // Don't create line underground + // Add to list for drawing + Vec3[] insertArray = {startBlock, new Vec3(endBlock.getX() + 0.5, endBlock.getY() + 0.5, endBlock.getZ() + 0.5)}; + creeperLines.add(insertArray); + } + } + } + } else { + drawCreeperLines = false; + } + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { + for (int i = 0; i < creeperLines.size(); i++) { + Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], event.partialTicks); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java new file mode 100644 index 0000000..b537198 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java @@ -0,0 +1,89 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; + +public class LividSolver { + + static boolean foundLivid = false; + static Entity livid = null; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + foundLivid = false; + livid = null; + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.lividSolverToggled && Utils.inDungeons && !foundLivid && world != null) { + boolean inF5 = false; + + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (F5)")) { + inF5 = true; + break; + } + } + + if (inF5) { + List loadedLivids = new ArrayList<>(); + List entities = world.getLoadedEntityList(); + for (Entity entity : entities) { + String name = entity.getName(); + if (name.contains("Livid") && name.length() > 5 && name.charAt(1) == name.charAt(5) && !loadedLivids.contains(entity)) { + loadedLivids.add(entity); + } + } + if (loadedLivids.size() > 8) { + livid = loadedLivids.get(0); + foundLivid = true; + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.lividSolverToggled && foundLivid && livid != null) { + new TextRenderer(Minecraft.getMinecraft(), livid.getName().replace("" + EnumChatFormatting.BOLD, ""), MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], ScaleCommand.lividHpScale); + } + } + + @SubscribeEvent + public void onRenderEntity(RenderLivingEvent.Pre event) { + Entity entity = event.entity; + String name = entity.getName(); + if (entity instanceof EntityArmorStand) { + if (ToggleCommand.lividSolverToggled && !entity.isEntityEqual(livid) && name.contains("Livid") && name.length() > 5 && name.charAt(1) == name.charAt(5)) { + event.setCanceled(true); + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/SelectAllColourSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SelectAllColourSolver.java new file mode 100644 index 0000000..cce89d2 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/SelectAllColourSolver.java @@ -0,0 +1,59 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class SelectAllColourSolver { + + static Pattern selectAllTerminalPattern = Pattern.compile("[A-Z]{2,}"); + static String terminalColorNeeded; + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + String displayName = event.displayName; + if (ToggleCommand.selectAllToggled && Utils.inDungeons && displayName.startsWith("Select all the")) { + String colour; + List colourParts = new ArrayList<>(); + Matcher colourMatcher = selectAllTerminalPattern.matcher(displayName); + while (colourMatcher.find()) { + colourParts.add(colourMatcher.group()); + } + colour = String.join(" ", colourParts); + terminalColorNeeded = colour; + + for (Slot slot : event.slots) { + if (slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) continue; + ItemStack item = slot.getStack(); + if (item == null) continue; + if (item.isItemEnchanted()) continue; + String itemName = StringUtils.stripControlCodes(item.getDisplayName()).toUpperCase(); + if (itemName.contains(terminalColorNeeded) || + (terminalColorNeeded.equals("SILVER") && itemName.contains("LIGHT GRAY")) || + (terminalColorNeeded.equals("WHITE") && (itemName.equals("WOOL") || itemName.equals("BONE MEAL"))) || + (terminalColorNeeded.equals("BLACK") && itemName.equals("INK SACK")) || + (terminalColorNeeded.equals("BLUE") && itemName.equals("LAPIS LAZULI")) || + (terminalColorNeeded.equals("BROWN") && itemName.equals("COCOA BEANS"))) { + Utils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); + } + } + } + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + terminalColorNeeded = null; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java new file mode 100644 index 0000000..8f15fa7 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/StartsWithSolver.java @@ -0,0 +1,31 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class StartsWithSolver { + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + String displayName = event.displayName; + if (ToggleCommand.startsWithToggled && Utils.inDungeons && displayName.startsWith("What starts with:")) { + char letter = displayName.charAt(displayName.indexOf("'") + 1); + for (Slot slot : event.slots) { + if (slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) continue; + ItemStack item = slot.getStack(); + if (item == null) continue; + if (item.isItemEnchanted()) continue; + if (StringUtils.stripControlCodes(item.getDisplayName()).charAt(0) == letter) { + Utils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/SuperpairsSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SuperpairsSolver.java new file mode 100644 index 0000000..c6e1d76 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/SuperpairsSolver.java @@ -0,0 +1,150 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.awt.*; +import java.util.List; +import java.util.*; + +public class SuperpairsSolver { + + static ItemStack[] experimentTableSlots = new ItemStack[54]; + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + ItemStack item = event.itemStack; + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + + if (mc.currentScreen instanceof GuiChest) { + ContainerChest chest = (ContainerChest) player.openContainer; + IInventory inv = chest.getLowerChestInventory(); + String chestName = inv.getDisplayName().getUnformattedText(); + + if (ToggleCommand.superpairsToggled && chestName.contains("Superpairs (")) { + if (Item.getIdFromItem(item.getItem()) != 95) return; + if (item.getDisplayName().contains("Click any button") || item.getDisplayName().contains("Click a second button") || item.getDisplayName().contains("Next button is instantly rewarded") || item.getDisplayName().contains("Stained Glass")) { + Slot slot = ((GuiChest) mc.currentScreen).getSlotUnderMouse(); + ItemStack itemStack = experimentTableSlots[slot.getSlotIndex()]; + if (itemStack == null) return; + String itemName = itemStack.getDisplayName(); + + if (event.toolTip.stream().anyMatch(x -> StringUtils.stripControlCodes(x).equals(StringUtils.stripControlCodes(itemName)))) + return; + event.toolTip.removeIf(x -> { + x = StringUtils.stripControlCodes(x); + if (x.equals("minecraft:stained_glass")) return true; + return x.startsWith("NBT: "); + }); + event.toolTip.add(itemName); + event.toolTip.add(itemStack.getItem().getRegistryName()); + } + + } + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + if (mc.currentScreen instanceof GuiChest) { + if (player == null) return; + ContainerChest chest = (ContainerChest) player.openContainer; + List invSlots = ((GuiChest) mc.currentScreen).inventorySlots.inventorySlots; + String chestName = chest.getLowerChestInventory().getDisplayName().getUnformattedText().trim(); + + if (ToggleCommand.superpairsToggled && chestName.startsWith("Superpairs (")) { + for (int i = 0; i < 53; i++) { + ItemStack itemStack = invSlots.get(i).getStack(); + if (itemStack == null) continue; + String itemName = itemStack.getDisplayName(); + if (Item.getIdFromItem(itemStack.getItem()) == 95 || Item.getIdFromItem(itemStack.getItem()) == 160) continue; + if (itemName.contains("Instant Find") || itemName.contains("Gained +")) continue; + if (itemName.contains("Enchanted Book")) { + itemName = itemStack.getTooltip(mc.thePlayer, false).get(3); + } + if (itemStack.stackSize > 1) { + itemName = itemStack.stackSize + " " + itemName; + } + if (experimentTableSlots[i] != null) continue; + experimentTableSlots[i] = itemStack.copy().setStackDisplayName(itemName); + } + } + } + } + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + if (ToggleCommand.superpairsToggled && event.displayName.contains("Superpairs (")) { + HashMap> matches = new HashMap<>(); + for (int i = 0; i < 53; i++) { + ItemStack itemStack = experimentTableSlots[i]; + if (itemStack == null) continue; + + //Utils.renderItem(itemStack, x, y, -100); + + String itemName = itemStack.getDisplayName(); + String keyName = itemName + itemStack.getUnlocalizedName(); + matches.computeIfAbsent(keyName, k -> new HashSet<>()); + matches.get(keyName).add(i); + } + + Color[] colors = { + new Color(255, 0, 0, 100), + new Color(0, 0, 255, 100), + new Color(100, 179, 113, 100), + new Color(255, 114, 255, 100), + new Color(255, 199, 87, 100), + new Color(119, 105, 198, 100), + new Color(135, 199, 112, 100), + new Color(240, 37, 240, 100), + new Color(178, 132, 190, 100), + new Color(63, 135, 163, 100), + new Color(146, 74, 10, 100), + new Color(255, 255, 255, 100), + new Color(217, 252, 140, 100), + new Color(255, 82, 82, 100) + }; + + Iterator colorIterator = Arrays.stream(colors).iterator(); + + matches.forEach((itemName, slotSet) -> { + if (slotSet.size() < 2) return; + ArrayList slots = new ArrayList<>(); + slotSet.forEach(slotNum -> slots.add(event.slots.get(slotNum))); + Color color = colorIterator.next(); + slots.forEach(slot -> { + Utils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, color.getRGB()); + }); + }); + } + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + experimentTableSlots = new ItemStack[54]; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java new file mode 100644 index 0000000..36721c1 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java @@ -0,0 +1,75 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.*; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.List; + +public class ThreeManSolver { + + static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", + "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", + "The reward isn't in any of our chests", "Both of them are telling the truth."}; + static BlockPos riddleChest = null; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + riddleChest = null; + } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inDungeons) return; + + if (ToggleCommand.threeManToggled && message.contains("[NPC]")) { + for (String solution : riddleSolutions) { + if (message.contains(solution)) { + Minecraft mc = Minecraft.getMinecraft(); + String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); + mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + DankersSkyblockMod.MAIN_COLOUR + " has the blessing.")); + if (riddleChest == null) { + List entities = mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + if (entity.getCustomNameTag().contains(npcName)) { + BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); + if (mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.north(); + } else if (mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.east(); + } else if (mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.south(); + } else if (mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.west(); + } else { + System.out.print("Could not find correct riddle chest."); + } + break; + } + } + } + break; + } + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.threeManToggled && riddleChest != null) { + Utils.drawFilled3DBox(new AxisAlignedBB(riddleChest.getX() - 0.05, riddleChest.getY(), riddleChest.getZ() - 0.05, riddleChest.getX() + 1.05, riddleChest.getY() + 1, riddleChest.getZ() + 1.05), 0x197F19, true, event.partialTicks); + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TicTacToeSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TicTacToeSolver.java new file mode 100644 index 0000000..1b4a2e1 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/TicTacToeSolver.java @@ -0,0 +1,135 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.TicTacToeUtils; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraft.world.storage.MapData; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class TicTacToeSolver { + + static AxisAlignedBB correctTicTacToeButton = null; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + World world = mc.theWorld; + EntityPlayerSP player = mc.thePlayer; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.ticTacToeToggled && Utils.inDungeons && world != null && player != null) { + correctTicTacToeButton = null; + AxisAlignedBB aabb = new AxisAlignedBB(player.posX - 6, player.posY - 6, player.posZ - 6, player.posX + 6, player.posY + 6, player.posZ + 6); + List itemFrames = world.getEntitiesWithinAABB(EntityItemFrame.class, aabb); + List itemFramesWithMaps = new ArrayList<>(); + // Find how many item frames have maps already placed + for (EntityItemFrame itemFrame : itemFrames) { + ItemStack item = itemFrame.getDisplayedItem(); + if (item == null || !(item.getItem() instanceof ItemMap)) continue; + MapData mapData = ((ItemMap) item.getItem()).getMapData(item, world); + if (mapData == null) continue; + + itemFramesWithMaps.add(itemFrame); + } + + // Only run when it's your turn + if (itemFramesWithMaps.size() != 9 && itemFramesWithMaps.size() % 2 == 1) { + char[][] board = new char[3][3]; + BlockPos leftmostRow = null; + int sign = 1; + char facing = 'X'; + for (EntityItemFrame itemFrame : itemFramesWithMaps) { + ItemStack map = itemFrame.getDisplayedItem(); + MapData mapData = ((ItemMap) map.getItem()).getMapData(map, world); + + // Find position on board + // I mixed up row and column here and I'm too lazy to fix it + int row = 0; + int column; + sign = 1; + + if (itemFrame.facingDirection == EnumFacing.SOUTH || itemFrame.facingDirection == EnumFacing.WEST) { + sign = -1; + } + + BlockPos itemFramePos = new BlockPos(itemFrame.posX, Math.floor(itemFrame.posY), itemFrame.posZ); + for (int i = 2; i >= 0; i--) { + int realI = i * sign; + BlockPos blockPos = itemFramePos; + if (itemFrame.posX % 0.5 == 0) { + blockPos = itemFramePos.add(realI, 0, 0); + } else if (itemFrame.posZ % 0.5 == 0) { + blockPos = itemFramePos.add(0, 0, realI); + facing = 'Z'; + } + Block block = world.getBlockState(blockPos).getBlock(); + if (block == Blocks.air || block == Blocks.stone_button) { + leftmostRow = blockPos; + row = i; + break; + } + } + + if (itemFrame.posY == 72.5) { + column = 0; + } else if (itemFrame.posY == 71.5) { + column = 1; + } else if (itemFrame.posY == 70.5) { + column = 2; + } else { + continue; + } + + // Get colour + // Middle pixel = 64*128 + 64 = 8256 + int colourInt = mapData.colors[8256] & 255; + if (colourInt == 114) { + board[column][row] = 'X'; + } else if (colourInt == 33) { + board[column][row] = 'O'; + } + } + System.out.println("Board: " + Arrays.deepToString(board)); + + // Draw best move + int bestMove = TicTacToeUtils.getBestMove(board) - 1; + System.out.println("Best move slot: " + bestMove); + if (leftmostRow != null) { + double drawX = facing == 'X' ? leftmostRow.getX() - sign * (bestMove % 3) : leftmostRow.getX(); + double drawY = 72 - Math.floor(bestMove / 3); + double drawZ = facing == 'Z' ? leftmostRow.getZ() - sign * (bestMove % 3) : leftmostRow.getZ(); + + correctTicTacToeButton = new AxisAlignedBB(drawX, drawY, drawZ, drawX + 1, drawY + 1, drawZ + 1); + } + } + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.ticTacToeToggled && correctTicTacToeButton != null) { + Utils.draw3DBox(correctTicTacToeButton, 0x40FF40, event.partialTicks); + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java new file mode 100644 index 0000000..ac2cd0c --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -0,0 +1,105 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.HashMap; +import java.util.Map; + +public class TriviaSolver { + + static Map triviaSolutions = new HashMap<>(); + static String[] triviaAnswers = null; + public static String TRIVIA_WRONG_ANSWER_COLOUR; + + @Mod.EventHandler + public void init(FMLInitializationEvent event) { + triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); + triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); + triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); + triviaSolutions.put("What is the status of The Professor?", new String[]{"Professor"}); + triviaSolutions.put("What is the status of Thorn?", new String[]{"Shaman Necromancer"}); + triviaSolutions.put("What is the status of Livid?", new String[]{"Master Necromancer"}); + triviaSolutions.put("What is the status of Sadan?", new String[]{"Necromancer Lord"}); + triviaSolutions.put("What is the status of Maxor?", new String[]{"Young Wither"}); + 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[]{"220 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 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 Barn?", new String[]{"7 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 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 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"}); + triviaSolutions.put("How many Fairy Souls are there in The Hub?", new String[]{"79 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Deep Caverns?", new String[]{"21 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Gold Mine?", new String[]{"12 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Dungeon Hub?", new String[]{"7 Fairy Souls"}); + triviaSolutions.put("Which brother is on the Spider's Den?", new String[]{"Rick"}); + triviaSolutions.put("What is the name of Rick's brother?", new String[]{"Pat"}); + triviaSolutions.put("What is the name of the Painter in the Hub?", new String[]{"Marco"}); + 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("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"}); + triviaSolutions.put("Which of these is not a dragon in The End?", new String[]{"Zoomer Dragon", "Weak Dragon", "Stonk Dragon", "Holy Dragon", "Boomer Dragon", + "Booger Dragon", "Older Dragon", "Elder Dragon", "Stable Dragon", "Professor Dragon"}); + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inDungeons) return; + if (event.type == 2) return; + + if (ToggleCommand.oruoToggled) { + if (message.contains("What SkyBlock year is it?")) { + double currentTime = System.currentTimeMillis() /1000L; + + double diff = Math.floor(currentTime - 1560276000); + + int year = (int) (diff / 446400 + 1); + triviaAnswers = new String[]{"Year " + year}; + } else { + for (String question : triviaSolutions.keySet()) { + if (message.contains(question)) { + triviaAnswers = triviaSolutions.get(question); + break; + } + } + } + + // Set wrong answers to red and remove click events + if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { + boolean isSolution = false; + for (String solution : triviaAnswers) { + if (message.contains(solution)) { + isSolution = true; + break; + } + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java new file mode 100644 index 0000000..87309fe --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java @@ -0,0 +1,112 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.lwjgl.input.Keyboard; + +import java.util.List; + +public class UltrasequencerSolver { + + static Slot[] clickInOrderSlots = new Slot[36]; + static int lastUltraSequencerClicked = 0; + public static int ULTRASEQUENCER_NEXT; + public static int ULTRASEQUENCER_NEXT_TO_NEXT; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + if (mc.currentScreen instanceof GuiChest) { + if (player == null) return; + ContainerChest chest = (ContainerChest) player.openContainer; + List invSlots = ((GuiChest) mc.currentScreen).inventorySlots.inventorySlots; + String chestName = chest.getLowerChestInventory().getDisplayName().getUnformattedText().trim(); + + if (ToggleCommand.ultrasequencerToggled && chestName.startsWith("Ultrasequencer (")) { + if (invSlots.get(49).getStack() != null && invSlots.get(49).getStack().getDisplayName().equals("§aRemember the pattern!")) { + for (int i = 9; i <= 44; i++) { + if (invSlots.get(i) == null || invSlots.get(i).getStack() == null) continue; + String itemName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()); + if (itemName.matches("\\d+")) { + int number = Integer.parseInt(itemName); + clickInOrderSlots[number - 1] = invSlots.get(i); + } + } + } + } + } + } + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + if (ToggleCommand.ultrasequencerToggled && event.inventoryName.startsWith("Ultrasequencer (")) { + IInventory inventory = event.inventory; + if (event.item == null) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) + event.setCanceled(true); + return; + } + if (inventory.getStackInSlot(49).getDisplayName().equals("§aRemember the pattern!")) { + if (event.isCancelable()) event.setCanceled(true); + return; + } else if (inventory.getStackInSlot(49).getDisplayName().startsWith("§7Timer: §a")) { + if (clickInOrderSlots[lastUltraSequencerClicked] != null && event.slot.getSlotIndex() != clickInOrderSlots[lastUltraSequencerClicked].getSlotIndex()) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) + event.setCanceled(true); + return; + } + } + } + } + + @SubscribeEvent + public void onGuiRender(GuiChestBackgroundDrawnEvent event) { + if (ToggleCommand.ultrasequencerToggled && event.displayName.startsWith("Ultrasequencer (")) { + List invSlots = event.slots; + if (invSlots.size() > 48 && invSlots.get(49).getStack() != null) { + if (invSlots.get(49).getStack().getDisplayName().startsWith("§7Timer: §a")) { + lastUltraSequencerClicked = 0; + for (Slot slot : clickInOrderSlots) { + if (slot != null && slot.getStack() != null && StringUtils.stripControlCodes(slot.getStack().getDisplayName()).matches("\\d+")) { + int number = Integer.parseInt(StringUtils.stripControlCodes(slot.getStack().getDisplayName())); + if (number > lastUltraSequencerClicked) { + lastUltraSequencerClicked = number; + } + } + } + if (clickInOrderSlots[lastUltraSequencerClicked] != null) { + Slot nextSlot = clickInOrderSlots[lastUltraSequencerClicked]; + Utils.drawOnSlot(event.chestSize, nextSlot.xDisplayPosition, nextSlot.yDisplayPosition, ULTRASEQUENCER_NEXT + 0xE5000000); + } + if (lastUltraSequencerClicked + 1 < clickInOrderSlots.length) { + if (clickInOrderSlots[lastUltraSequencerClicked + 1] != null) { + Slot nextSlot = clickInOrderSlots[lastUltraSequencerClicked + 1]; + Utils.drawOnSlot(event.chestSize, nextSlot.xDisplayPosition, nextSlot.yDisplayPosition, ULTRASEQUENCER_NEXT_TO_NEXT + 0xD7000000); + } + } + } + } + } + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + clickInOrderSlots = new Slot[36]; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/WaterSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/WaterSolver.java new file mode 100644 index 0000000..2be92f9 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/WaterSolver.java @@ -0,0 +1,162 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class WaterSolver { + + static boolean prevInWaterRoom = false; + static boolean inWaterRoom = false; + static String waterAnswers = null; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + World world = mc.theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.waterToggled && Utils.inDungeons && world != null && player != null) { + // multi thread block checking + new Thread(() -> { + prevInWaterRoom = inWaterRoom; + inWaterRoom = false; + boolean foundPiston = false; + boolean done = false; + for (int x = (int) (player.posX - 13); x <= player.posX + 13; x++) { + for (int z = (int) (player.posZ - 13); z <= player.posZ + 13; z++) { + BlockPos blockPos = new BlockPos(x, 54, z); + if (world.getBlockState(blockPos).getBlock() == Blocks.sticky_piston) { + foundPiston = true; + break; + } + } + if (foundPiston) break; + } + + if (foundPiston) { + for (int x = (int) (player.posX - 25); x <= player.posX + 25; x++) { + for (int z = (int) (player.posZ - 25); z <= player.posZ + 25; z++) { + BlockPos blockPos = new BlockPos(x, 82, z); + if (world.getBlockState(blockPos).getBlock() == Blocks.piston_head) { + inWaterRoom = true; + if (!prevInWaterRoom) { + boolean foundGold = false; + boolean foundClay = false; + boolean foundEmerald = false; + boolean foundQuartz = false; + boolean foundDiamond = false; + + // Detect first blocks near water stream + BlockPos scan1 = new BlockPos(x + 1, 78, z + 1); + BlockPos scan2 = new BlockPos(x - 1, 77, z - 1); + Iterable blocks = BlockPos.getAllInBox(scan1, scan2); + for (BlockPos puzzleBlockPos : blocks) { + Block block = world.getBlockState(puzzleBlockPos).getBlock(); + if (block == Blocks.gold_block) { + foundGold = true; + } else if (block == Blocks.hardened_clay) { + foundClay = true; + } else if (block == Blocks.emerald_block) { + foundEmerald = true; + } else if (block == Blocks.quartz_block) { + foundQuartz = true; + } else if (block == Blocks.diamond_block) { + foundDiamond = true; + } + } + + int variant = 0; + if (foundGold && foundClay) { + variant = 1; + } else if (foundEmerald && foundQuartz) { + variant = 2; + } else if (foundQuartz && foundDiamond) { + variant = 3; + } else if (foundGold && foundQuartz) { + variant = 4; + } + + // Return solution + String purple; + String orange; + String blue; + String green; + String red; + switch (variant) { + case 1: + purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond, " + EnumChatFormatting.RED + "Clay"; + orange = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal, " + EnumChatFormatting.GREEN + "Emerald"; + blue = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + green = EnumChatFormatting.GREEN + "Emerald"; + red = EnumChatFormatting.GRAY + "None"; + break; + case 2: + purple = EnumChatFormatting.DARK_GRAY + "Coal"; + orange = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + blue = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.AQUA + "Diamond, " + EnumChatFormatting.GREEN + "Emerald"; + green = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.GREEN + "Emerald"; + red = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.DARK_GRAY + "Coal, " + EnumChatFormatting.GREEN + "Emerald"; + break; + case 3: + purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond"; + orange = EnumChatFormatting.GREEN + "Emerald"; + blue = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.AQUA + "Diamond"; + green = EnumChatFormatting.GRAY + "None"; + red = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald"; + break; + case 4: + purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + orange = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal"; + blue = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + green = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald"; + red = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + break; + default: + purple = orange = blue = green = red = DankersSkyblockMod.ERROR_COLOUR + "Error detecting water puzzle variant."; + break; + } + waterAnswers = DankersSkyblockMod.MAIN_COLOUR + "The following levers must be down:\n" + + EnumChatFormatting.DARK_PURPLE + "Purple: " + purple + "\n" + + EnumChatFormatting.GOLD + "Orange: " + orange + "\n" + + EnumChatFormatting.BLUE + "Blue: " + blue + "\n" + + EnumChatFormatting.GREEN + "Green: " + green + "\n" + + EnumChatFormatting.RED + "Red: " + red; + done = true; + break; + } + } + } + if (done) break; + } + } else { + waterAnswers = null; + } + }).start(); + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.waterToggled && Utils.inDungeons && waterAnswers != null) { + new TextRenderer(Minecraft.getMinecraft(), waterAnswers, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], ScaleCommand.waterAnswerScale); + } + } + +} -- cgit From abeb54dbea7e4219f4a277211cd33df3aff39dd9 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 27 Feb 2021 19:06:17 -0500 Subject: Make config handling easier And move display variables to LootDisplay.java --- .../java/me/Danker/commands/DankerGuiCommand.java | 5 +- .../java/me/Danker/commands/DisplayCommand.java | 79 +- src/main/java/me/Danker/features/AutoDisplay.java | 29 +- .../java/me/Danker/features/loot/LootDisplay.java | 9 +- src/main/java/me/Danker/gui/DisplayGui.java | 11 +- .../java/me/Danker/handlers/ConfigHandler.java | 845 ++++++++------------- 6 files changed, 370 insertions(+), 608 deletions(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index deddc01..5ffd754 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -2,6 +2,7 @@ package me.Danker.commands; import me.Danker.DankersSkyblockMod; import me.Danker.features.SkillTracker; +import me.Danker.features.loot.LootDisplay; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.ResourcePackRepository; import net.minecraft.command.CommandBase; @@ -92,8 +93,8 @@ public class DankerGuiCommand extends CommandBase { debug.append("[skilltracker][").append(MoveCommand.skillTrackerXY[0]).append(", ").append(MoveCommand.skillTrackerXY[1]).append("]\n"); debug.append("[wateranswer][").append(MoveCommand.waterAnswerXY[0]).append(", ").append(MoveCommand.waterAnswerXY[1]).append("]\n"); debug.append("# Other Settings\n"); - debug.append("[Current Display][").append(DisplayCommand.display).append("]\n"); - debug.append("[Auto Display][").append(DisplayCommand.auto).append("]\n"); + debug.append("[Current Display][").append(LootDisplay.display).append("]\n"); + debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n"); debug.append("[Skill Tracker Visible][").append(SkillTracker.showSkillTracker).append("]\n"); debug.append("# Resource Packs\n"); if (Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries().size() == 0) { diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index d20491b..74f142a 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -1,6 +1,7 @@ package me.Danker.commands; import me.Danker.DankersSkyblockMod; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -12,8 +13,6 @@ import net.minecraft.util.ChatComponentText; import java.util.List; public class DisplayCommand extends CommandBase { - public static String display; - public static boolean auto; @Override public String getCommandName() { @@ -60,23 +59,23 @@ public class DisplayCommand extends CommandBase { switch (arg1[0].toLowerCase()) { case "wolf": if (showSession) { - display = "wolf_session"; + LootDisplay.display = "wolf_session"; } else { - display = "wolf"; + LootDisplay.display = "wolf"; } break; case "spider": if (showSession) { - display = "spider_session"; + LootDisplay.display = "spider_session"; } else { - display = "spider"; + LootDisplay.display = "spider"; } break; case "zombie": if (showSession) { - display = "zombie_session"; + LootDisplay.display = "zombie_session"; } else { - display = "zombie"; + LootDisplay.display = "zombie"; } break; case "fishing": @@ -84,45 +83,45 @@ public class DisplayCommand extends CommandBase { switch (arg1[1].toLowerCase()) { case "winter": if (showSession) { - display = "fishing_winter_session"; + LootDisplay.display = "fishing_winter_session"; } else { - display = "fishing_winter"; + LootDisplay.display = "fishing_winter"; } break; case "festival": if (showSession) { - display = "fishing_festival_session"; + LootDisplay.display = "fishing_festival_session"; } else { - display = "fishing_festival"; + LootDisplay.display = "fishing_festival"; } break; case "spooky": if (showSession) { - display = "fishing_spooky_session"; + LootDisplay.display = "fishing_spooky_session"; } else { - display = "fishing_spooky"; + LootDisplay.display = "fishing_spooky"; } break; default: if (showSession) { - display = "fishing_session"; + LootDisplay.display = "fishing_session"; } else { - display = "fishing"; + LootDisplay.display = "fishing"; } } } else { if (showSession) { - display = "fishing_session"; + LootDisplay.display = "fishing_session"; } else { - display = "fishing"; + LootDisplay.display = "fishing"; } } break; case "mythological": if (showSession) { - display = "mythological_session"; + LootDisplay.display = "mythological_session"; } else { - display = "mythological"; + LootDisplay.display = "mythological"; } break; case "catacombs": @@ -135,57 +134,57 @@ public class DisplayCommand extends CommandBase { case "f1": case "floor1": if (showSession) { - display = "catacombs_floor_one_session"; + LootDisplay.display = "catacombs_floor_one_session"; } else { - display = "catacombs_floor_one"; + LootDisplay.display = "catacombs_floor_one"; } break; case "f2": case "floor2": if (showSession) { - display = "catacombs_floor_two_session"; + LootDisplay.display = "catacombs_floor_two_session"; } else { - display = "catacombs_floor_two"; + LootDisplay.display = "catacombs_floor_two"; } break; case "f3": case "floor3": if (showSession) { - display = "catacombs_floor_three_session"; + LootDisplay.display = "catacombs_floor_three_session"; } else { - display = "catacombs_floor_three"; + LootDisplay.display = "catacombs_floor_three"; } break; case "f4": case "floor4": if (showSession) { - display = "catacombs_floor_four_session"; + LootDisplay.display = "catacombs_floor_four_session"; } else { - display = "catacombs_floor_four"; + LootDisplay.display = "catacombs_floor_four"; } break; case "f5": case "floor5": if (showSession) { - display = "catacombs_floor_five_session"; + LootDisplay.display = "catacombs_floor_five_session"; } else { - display = "catacombs_floor_five"; + LootDisplay.display = "catacombs_floor_five"; } break; case "f6": case "floor6": if (showSession) { - display = "catacombs_floor_six_session"; + LootDisplay.display = "catacombs_floor_six_session"; } else { - display = "catacombs_floor_six"; + LootDisplay.display = "catacombs_floor_six"; } break; case "f7": case "floor7": if (showSession) { - display = "catacombs_floor_seven_session"; + LootDisplay.display = "catacombs_floor_seven_session"; } else { - display = "catacombs_floor_seven"; + LootDisplay.display = "catacombs_floor_seven"; } break; default: @@ -194,22 +193,22 @@ public class DisplayCommand extends CommandBase { } break; case "auto": - auto = true; + LootDisplay.auto = true; player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + "auto" + DankersSkyblockMod.MAIN_COLOUR + ".")); ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); return; case "off": - display = "off"; + LootDisplay.display = "off"; break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } - - auto = false; - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + display + DankersSkyblockMod.MAIN_COLOUR + ".")); + + LootDisplay.auto = false; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + LootDisplay.display + DankersSkyblockMod.MAIN_COLOUR + ".")); ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); - ConfigHandler.writeStringConfig("misc", "display", display); + ConfigHandler.writeStringConfig("misc", "display", LootDisplay.display); } } diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index aaed4ca..5411034 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -2,6 +2,7 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import net.minecraft.client.Minecraft; @@ -23,35 +24,35 @@ public class AutoDisplay { World world = mc.theWorld; EntityPlayerSP player = mc.thePlayer; if (DankersSkyblockMod.tickAmount % 20 == 0) { - if (DisplayCommand.auto && world != null && player != null) { + if (LootDisplay.auto && world != null && player != null) { List scoreboard = ScoreboardHandler.getSidebarLines(); boolean found = false; for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); if (sCleaned.contains("Sven Packmaster")) { - DisplayCommand.display = "wolf"; + LootDisplay.display = "wolf"; found = true; } else if (sCleaned.contains("Tarantula Broodfather")) { - DisplayCommand.display = "spider"; + LootDisplay.display = "spider"; found = true; } else if (sCleaned.contains("Revenant Horror")) { - DisplayCommand.display = "zombie"; + LootDisplay.display = "zombie"; found = true; } else if (sCleaned.contains("The Catacombs (")) { if (sCleaned.contains("F1")) { - DisplayCommand.display = "catacombs_floor_one"; + LootDisplay.display = "catacombs_floor_one"; } else if (sCleaned.contains("F2")) { - DisplayCommand.display = "catacombs_floor_two"; + LootDisplay.display = "catacombs_floor_two"; } else if (sCleaned.contains("F3")) { - DisplayCommand.display = "catacombs_floor_three"; + LootDisplay.display = "catacombs_floor_three"; } else if (sCleaned.contains("F4")) { - DisplayCommand.display = "catacombs_floor_four"; + LootDisplay.display = "catacombs_floor_four"; } else if (sCleaned.contains("F5")) { - DisplayCommand.display = "catacombs_floor_five"; + LootDisplay.display = "catacombs_floor_five"; } else if (sCleaned.contains("F6")) { - DisplayCommand.display = "catacombs_floor_six"; + LootDisplay.display = "catacombs_floor_six"; } else if (sCleaned.contains("F7")) { - DisplayCommand.display = "catacombs_floor_seven"; + LootDisplay.display = "catacombs_floor_seven"; } found = true; } @@ -60,12 +61,12 @@ public class AutoDisplay { ItemStack hotbarItem = player.inventory.getStackInSlot(i); if (hotbarItem == null) continue; if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { - DisplayCommand.display = "mythological"; + LootDisplay.display = "mythological"; found = true; } } - if (!found) DisplayCommand.display = "off"; - ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); + if (!found) LootDisplay.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", LootDisplay.display); } } } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index d4868e3..4013c0a 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -17,9 +17,12 @@ import java.util.Locale; public class LootDisplay { + public static String display; + public static boolean auto; + @SubscribeEvent public void renderPlayerInfo(RenderOverlay event) { - if (!DisplayCommand.display.equals("off")) { + if (!display.equals("off")) { Minecraft mc = Minecraft.getMinecraft(); String dropsText = ""; String countText = ""; @@ -31,7 +34,7 @@ public class LootDisplay { double timeNow = System.currentTimeMillis() / 1000; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); - switch (DisplayCommand.display) { + switch (display) { case "wolf": if (LootTracker.wolfTime == -1) { timeBetween = "Never"; @@ -892,7 +895,7 @@ public class LootDisplay { break; default: System.out.println("Display was an unknown value, turning off."); - DisplayCommand.display = "off"; + display = "off"; ConfigHandler.writeStringConfig("misc", "display", "off"); } new TextRenderer(mc, dropsText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 2f704b3..4e5831d 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -2,6 +2,7 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; @@ -94,10 +95,10 @@ public class DisplayGui extends GuiScreen { Minecraft mc = Minecraft.getMinecraft(); String displayText; - if (DisplayCommand.auto) { + if (LootDisplay.auto) { displayText = "Current Display: auto"; } else { - displayText = "Current Display: " + DisplayCommand.display; + displayText = "Current Display: " + LootDisplay.display; } int displayWidth = mc.fontRendererObj.getStringWidth(displayText); new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); @@ -125,7 +126,7 @@ public class DisplayGui extends GuiScreen { } else if (button == wolf) { setDisplay("wolf", false); } else if (button == auto) { - DisplayCommand.auto = true; + LootDisplay.auto = true; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); } else if (button == fishing) { setDisplay("fishing", false); @@ -156,8 +157,8 @@ public class DisplayGui extends GuiScreen { public void setDisplay(String display, boolean forceNoSession) { if (!forceNoSession && addSession) display += "_session"; - DisplayCommand.auto = false; - DisplayCommand.display = display; + LootDisplay.auto = false; + LootDisplay.display = display; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); ConfigHandler.writeStringConfig("misc", "display", display); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 7c51b1b..53f499b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -6,6 +6,7 @@ import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import me.Danker.features.*; +import me.Danker.features.loot.LootDisplay; import me.Danker.features.loot.LootTracker; import me.Danker.features.puzzlesolvers.*; import net.minecraft.client.Minecraft; @@ -170,354 +171,103 @@ public class ConfigHandler { config.save(); } } - - public static void reloadConfig() { - // Config init - if (!hasKey("toggles", "GParty")) writeBooleanConfig("toggles", "GParty", false); - if (!hasKey("toggles", "Coords")) writeBooleanConfig("toggles", "Coords", false); - if (!hasKey("toggles", "Golden")) writeBooleanConfig("toggles", "Golden", false); - if (!hasKey("toggles", "SlayerCount")) writeBooleanConfig("toggles", "SlayerCount", true); - if (!hasKey("toggles", "RNGesusAlerts")) writeBooleanConfig("toggles", "RNGesusAlerts", true); - if (!hasKey("toggles", "SplitFishing")) writeBooleanConfig("toggles", "SplitFishing", true); - if (!hasKey("toggles", "ChatMaddox")) writeBooleanConfig("toggles", "ChatMaddox", true); - if (!hasKey("toggles", "SpiritBearAlerts")) writeBooleanConfig("toggles", "SpiritBearAlerts", true); - if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false); - if (!hasKey("toggles", "LividDagger")) writeBooleanConfig("toggles", "LividDagger", false); - if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); - if (!hasKey("toggles", "ImplosionMessages")) writeBooleanConfig("toggles", "ImplosionMessages", true); - if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); - if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false); - if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); - if (!hasKey("toggles", "GolemAlerts")) writeBooleanConfig("toggles", "GolemAlerts", false); - if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); - if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); - if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); - if (!hasKey("toggles", "CakeTimer")) writeBooleanConfig("toggles", "CakeTimer", false); - // Chat Messages - if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true); - if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); - if (!hasKey("toggles", "ImplosionMessages")) writeBooleanConfig("toggles", "ImplosionMessages", true); - if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); - if (!hasKey("toggles", "CooldownMessages")) writeBooleanConfig("toggles","CooldownMessages",true); - if (!hasKey("toggles", "ManaMessages")) writeBooleanConfig("toggles","ManaMessages",true); - // Dungeons - if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); - if (!hasKey("toggles", "LowHealthNotify")) writeBooleanConfig("toggles", "LowHealthNotify", false); - if (!hasKey("toggles", "LividSolver")) writeBooleanConfig("toggles", "LividSolver", false); - if (!hasKey("toggles", "StopSalvageStarred")) writeBooleanConfig("toggles", "StopSalvageStarred", false); - if (!hasKey("toggles", "WatcherReadyMessage")) writeBooleanConfig("toggles", "WatcherReadyMessage", false); - if (!hasKey("toggles", "PickBlock")) writeBooleanConfig("toggles", "PickBlock", false); - if (!hasKey("toggles", "FlowerWeapons")) writeBooleanConfig("toggles", "FlowerWeapons", false); - if (!hasKey("toggles", "NotifySlayerSlain")) writeBooleanConfig("toggles", "NotifySlayerSlain", false); - if (!hasKey("toggles", "NecronNotifications")) writeBooleanConfig("toggles", "NecronNotifications", false); - if (!hasKey("toggles", "BonzoTimer")) writeBooleanConfig("toggles", "BonzoTimer", false); - if (!hasKey("toggles", "AutoSkillTracker")) writeBooleanConfig("toggles", "AutoSkillTracker", false); - // Puzzle Solvers - if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); - if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); - if (!hasKey("toggles", "BlazePuzzle")) writeBooleanConfig("toggles", "BlazePuzzle", false); - if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); - if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); - if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); - if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); - if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); - if (!hasKey("toggles", "ClickInOrderTerminal")) writeBooleanConfig("toggles", "ClickInOrderTerminal", false); - if (!hasKey("toggles", "BlockWrongTerminalClicks")) writeBooleanConfig("toggles", "BlockWrongTerminalClicks", false); - if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); - // Experiment Solvers - if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false); - if (!hasKey("toggles", "Chronomatron")) writeBooleanConfig("toggles", "Chronomatron", false); - if (!hasKey("toggles", "Superpairs")) writeBooleanConfig("toggles", "Superpairs", false); - if (!hasKey("toggles", "HideTooltipsInExperimentAddons")) writeBooleanConfig("toggles", "HideTooltipsInExperimentAddons", false); - if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); - - // Wolf Loot - if (!hasKey("wolf", "svens")) writeIntConfig("wolf", "svens", 0); - if (!hasKey("wolf", "teeth")) writeIntConfig("wolf", "teeth", 0); - if (!hasKey("wolf", "wheel")) writeIntConfig("wolf", "wheel", 0); - if (!hasKey("wolf", "wheelDrops")) writeIntConfig("wolf", "wheelDrops", 0); - if (!hasKey("wolf", "spirit")) writeIntConfig("wolf", "spirit", 0); - if (!hasKey("wolf", "book")) writeIntConfig("wolf", "book", 0); - if (!hasKey("wolf", "egg")) writeIntConfig("wolf", "egg", 0); - if (!hasKey("wolf", "couture")) writeIntConfig("wolf", "couture", 0); - if (!hasKey("wolf", "bait")) writeIntConfig("wolf", "bait", 0); - if (!hasKey("wolf", "flux")) writeIntConfig("wolf", "flux", 0); - if (!hasKey("wolf", "timeRNG")) writeDoubleConfig("wolf", "timeRNG", -1); - if (!hasKey("wolf", "bossRNG")) writeIntConfig("wolf", "bossRNG", -1); - // Spider Loot - if (!hasKey("spider", "tarantulas")) writeIntConfig("spider", "tarantulas", 0); - if (!hasKey("spider", "web")) writeIntConfig("spider", "web", 0); - if (!hasKey("spider", "tap")) writeIntConfig("spider", "tap", 0); - if (!hasKey("spider", "tapDrops")) writeIntConfig("spider", "tapDrops", 0); - if (!hasKey("spider", "bite")) writeIntConfig("spider", "bite", 0); - if (!hasKey("spider", "catalyst")) writeIntConfig("spider", "catalyst", 0); - if (!hasKey("spider", "book")) writeIntConfig("spider", "book", 0); - if (!hasKey("spider", "swatter")) writeIntConfig("spider", "swatter", 0); - if (!hasKey("spider", "talisman")) writeIntConfig("spider", "talisman", 0); - if (!hasKey("spider", "mosquito")) writeIntConfig("spider", "mosquito", 0); - if (!hasKey("spider", "timeRNG")) writeDoubleConfig("spider", "timeRNG", -1); - if (!hasKey("spider", "bossRNG")) writeIntConfig("spider", "bossRNG", -1); - // Zombie Loot - if (!hasKey("zombie", "revs")) writeIntConfig("zombie", "revs", 0); - if (!hasKey("zombie", "revFlesh")) writeIntConfig("zombie", "revFlesh", 0); - if (!hasKey("zombie", "foulFlesh")) writeIntConfig("zombie", "foulFlesh", 0); - if (!hasKey("zombie", "foulFleshDrops")) writeIntConfig("zombie", "foulFleshDrops", 0); - if (!hasKey("zombie", "pestilence")) writeIntConfig("zombie", "pestilence", 0); - if (!hasKey("zombie", "undeadCatalyst")) writeIntConfig("zombie", "undeadCatalyst", 0); - if (!hasKey("zombie", "book")) writeIntConfig("zombie", "book", 0); - if (!hasKey("zombie", "beheaded")) writeIntConfig("zombie", "beheaded", 0); - if (!hasKey("zombie", "revCatalyst")) writeIntConfig("zombie", "revCatalyst", 0); - if (!hasKey("zombie", "snake")) writeIntConfig("zombie", "snake", 0); - if (!hasKey("zombie", "scythe")) writeIntConfig("zombie", "scythe", 0); - if (!hasKey("zombie", "timeRNG")) writeDoubleConfig("zombie", "timeRNG", -1); - if (!hasKey("zombie", "bossRNG")) writeIntConfig("zombie", "bossRNG", -1); - - // Fishing - if (!hasKey("fishing", "seaCreature")) writeIntConfig("fishing", "seaCreature", 0); - if (!hasKey("fishing", "goodCatch")) writeIntConfig("fishing", "goodCatch", 0); - if (!hasKey("fishing", "greatCatch")) writeIntConfig("fishing", "greatCatch", 0); - if (!hasKey("fishing", "squid")) writeIntConfig("fishing", "squid", 0); - if (!hasKey("fishing", "seaWalker")) writeIntConfig("fishing", "seaWalker", 0); - if (!hasKey("fishing", "nightSquid")) writeIntConfig("fishing", "nightSquid", 0); - if (!hasKey("fishing", "seaGuardian")) writeIntConfig("fishing", "seaGuardian", 0); - if (!hasKey("fishing", "seaWitch")) writeIntConfig("fishing", "seaWitch", 0); - if (!hasKey("fishing", "seaArcher")) writeIntConfig("fishing", "seaArcher", 0); - if (!hasKey("fishing", "monsterOfDeep")) writeIntConfig("fishing", "monsterOfDeep", 0); - if (!hasKey("fishing", "catfish")) writeIntConfig("fishing", "catfish", 0); - if (!hasKey("fishing", "carrotKing")) writeIntConfig("fishing", "carrotKing", 0); - if (!hasKey("fishing", "seaLeech")) writeIntConfig("fishing", "seaLeech", 0); - if (!hasKey("fishing", "guardianDefender")) writeIntConfig("fishing", "guardianDefender", 0); - if (!hasKey("fishing", "deepSeaProtector")) writeIntConfig("fishing", "deepSeaProtector", 0); - if (!hasKey("fishing", "hydra")) writeIntConfig("fishing", "hydra", 0); - if (!hasKey("fishing", "seaEmperor")) writeIntConfig("fishing", "seaEmperor", 0); - if (!hasKey("fishing", "empTime")) writeDoubleConfig("fishing", "empTime", -1); - if (!hasKey("fishing", "empSC")) writeIntConfig("fishing", "empSC", -1); - if (!hasKey("fishing", "milestone")) writeIntConfig("fishing", "milestone", 0); - // Fishing Winter - if (!hasKey("fishing", "frozenSteve")) writeIntConfig("fishing", "frozenSteve", 0); - if (!hasKey("fishing", "snowman")) writeIntConfig("fishing", "snowman", 0); - if (!hasKey("fishing", "grinch")) writeIntConfig("fishing", "grinch", 0); - if (!hasKey("fishing", "yeti")) writeIntConfig("fishing", "yeti", 0); - if (!hasKey("fishing", "yetiTime")) writeDoubleConfig("fishing", "yetiTime", -1); - if (!hasKey("fishing", "yetiSC")) writeIntConfig("fishing", "yetiSC", -1); - // Fishing Festival - if (!hasKey("fishing", "nurseShark")) writeIntConfig("fishing", "nurseShark", 0); - if (!hasKey("fishing", "blueShark")) writeIntConfig("fishing", "blueShark", 0); - if (!hasKey("fishing", "tigerShark")) writeIntConfig("fishing", "tigerShark", 0); - if (!hasKey("fishing", "greatWhiteShark")) writeIntConfig("fishing", "greatWhiteShark", 0); - // Spooky Fishing - if (!hasKey("fishing", "scarecrow")) writeIntConfig("fishing", "scarecrow", 0); - if (!hasKey("fishing", "nightmare")) writeIntConfig("fishing", "nightmare", 0); - if (!hasKey("fishing", "werewolf")) writeIntConfig("fishing", "werewolf", 0); - if (!hasKey("fishing", "phantomFisher")) writeIntConfig("fishing", "phantomFisher", 0); - if (!hasKey("fishing", "grimReaper")) writeIntConfig("fishing", "grimReaper", 0); - - // Mythological - if (!hasKey("mythological", "coins")) writeDoubleConfig("mythological", "coins", 0); - if (!hasKey("mythological", "griffinFeather")) writeIntConfig("mythological", "griffinFeather", 0); - if (!hasKey("mythological", "crownOfGreed")) writeIntConfig("mythological", "crownOfGreed", 0); - if (!hasKey("mythological", "washedUpSouvenir")) writeIntConfig("mythological", "washedUpSouvenir", 0); - if (!hasKey("mythological", "minosHunter")) writeIntConfig("mythological", "minosHunter", 0); - if (!hasKey("mythological", "siameseLynx")) writeIntConfig("mythological", "siameseLynx", 0); - if (!hasKey("mythological", "minotaur")) writeIntConfig("mythological", "minotaur", 0); - if (!hasKey("mythological", "gaiaConstruct")) writeIntConfig("mythological", "gaiaConstruct", 0); - if (!hasKey("mythological", "minosChampion")) writeIntConfig("mythological", "minosChampion", 0); - if (!hasKey("mythological", "minosInquisitor")) writeIntConfig("mythological", "minosInquisitor", 0); - - // Dungeons - if (!hasKey("catacombs", "recombobulator")) writeIntConfig("catacombs", "recombobulator", 0); - if (!hasKey("catacombs", "fumingBooks")) writeIntConfig("catacombs", "fumingBooks", 0); - // F1 - if (!hasKey("catacombs", "bonzoStaff")) writeIntConfig("catacombs", "bonzoStaff", 0); - if (!hasKey("catacombs", "floorOneCoins")) writeDoubleConfig("catacombs", "floorOneCoins", 0); - if (!hasKey("catacombs", "floorOneTime")) writeDoubleConfig("catacombs", "floorOneTime", 0); - // F2 - if (!hasKey("catacombs", "scarfStudies")) writeIntConfig("catacombs", "scarfStudies", 0); - if (!hasKey("catacombs", "floorTwoCoins")) writeDoubleConfig("catacombs", "floorTwoCoins", 0); - if (!hasKey("catacombs", "floorTwoTime")) writeDoubleConfig("catacombs", "floorTwoTime", 0); - // F3 - if (!hasKey("catacombs", "adaptiveHelm")) writeIntConfig("catacombs", "adaptiveHelm", 0); - if (!hasKey("catacombs", "adaptiveChest")) writeIntConfig("catacombs", "adaptiveChest", 0); - if (!hasKey("catacombs", "adaptiveLegging")) writeIntConfig("catacombs", "adaptiveLegging", 0); - if (!hasKey("catacombs", "adaptiveBoot")) writeIntConfig("catacombs", "adaptiveBoot", 0); - if (!hasKey("catacombs", "adaptiveSword")) writeIntConfig("catacombs", "adaptiveSword", 0); - if (!hasKey("catacombs", "floorThreeCoins")) writeDoubleConfig("catacombs", "floorThreeCoins", 0); - if (!hasKey("catacombs", "floorThreeTime")) writeDoubleConfig("catacombs", "floorThreeTime", 0); - // F4 - if (!hasKey("catacombs", "spiritWing")) writeIntConfig("catacombs", "spiritWing", 0); - if (!hasKey("catacombs", "spiritBone")) writeIntConfig("catacombs", "spiritBone", 0); - if (!hasKey("catacombs", "spiritBoot")) writeIntConfig("catacombs", "spiritBoot", 0); - if (!hasKey("catacombs", "spiritSword")) writeIntConfig("catacombs", "spiritSword", 0); - if (!hasKey("catacombs", "spiritBow")) writeIntConfig("catacombs", "spiritBow", 0); - if (!hasKey("catacombs", "spiritPetEpic")) writeIntConfig("catacombs", "spiritPetEpic", 0); - if (!hasKey("catacombs", "spiritPetLeg")) writeIntConfig("catacombs", "spiritPetLeg", 0); - if (!hasKey("catacombs", "floorFourCoins")) writeDoubleConfig("catacombs", "floorFourCoins", 0); - if (!hasKey("catacombs", "floorFourTime")) writeDoubleConfig("catacombs", "floorFourTime", 0); - // F5 - if (!hasKey("catacombs", "warpedStone")) writeIntConfig("catacombs", "warpedStone", 0); - if (!hasKey("catacombs", "shadowAssassinHelm")) writeIntConfig("catacombs", "shadowAssassinHelm", 0); - if (!hasKey("catacombs", "shadowAssassinChest")) writeIntConfig("catacombs", "shadowAssassinChest", 0); - if (!hasKey("catacombs", "shadowAssassinLegging")) writeIntConfig("catacombs", "shadowAssassinLegging", 0); - if (!hasKey("catacombs", "shadowAssassinBoot")) writeIntConfig("catacombs", "shadowAssassinBoot", 0); - if (!hasKey("catacombs", "lastBreath")) writeIntConfig("catacombs", "lastBreath", 0); - if (!hasKey("catacombs", "lividDagger")) writeIntConfig("catacombs", "lividDagger", 0); - if (!hasKey("catacombs", "shadowFury")) writeIntConfig("catacombs", "shadowFury", 0); - if (!hasKey("catacombs", "floorFiveCoins")) writeDoubleConfig("catacombs", "floorFiveCoins", 0); - if (!hasKey("catacombs", "floorFiveTime")) writeDoubleConfig("catacombs", "floorFiveTime", 0); - // F6 - if (!hasKey("catacombs", "ancientRose")) writeIntConfig("catacombs", "ancientRose", 0); - if (!hasKey("catacombs", "precursorEye")) writeIntConfig("catacombs", "precursorEye", 0); - if (!hasKey("catacombs", "giantsSword")) writeIntConfig("catacombs", "giantsSword", 0); - if (!hasKey("catacombs", "necroLordHelm")) writeIntConfig("catacombs", "necroHelm", 0); - if (!hasKey("catacombs", "necroLordChest")) writeIntConfig("catacombs", "necroChest", 0); - if (!hasKey("catacombs", "necroLordLegging")) writeIntConfig("catacombs", "necroLegging", 0); - if (!hasKey("catacombs", "necroLordBoot")) writeIntConfig("catacombs", "necroBoot", 0); - if (!hasKey("catacombs", "necroSword")) writeIntConfig("catacombs", "necroSword", 0); - if (!hasKey("catacombs", "floorSixCoins")) writeDoubleConfig("catacombs", "floorSixCoins", 0); - if (!hasKey("catacombs", "floorSixTime")) writeDoubleConfig("catacombs", "floorSixTime", 0); - // F7 - if (!hasKey("catacombs", "witherBlood")) writeIntConfig("catacombs", "witherBlood", 0); - if (!hasKey("catacombs", "witherCloak")) writeIntConfig("catacombs", "witherCloak", 0); - if (!hasKey("catacombs", "implosion")) writeIntConfig("catacombs", "implosion", 0); - if (!hasKey("catacombs", "witherShield")) writeIntConfig("catacombs", "witherShield", 0); - if (!hasKey("catacombs", "shadowWarp")) writeIntConfig("catacombs", "shadowWarp", 0); - if (!hasKey("catacombs", "necronsHandle")) writeIntConfig("catacombs", "necronsHandle", 0); - if (!hasKey("catacombs", "autoRecomb")) writeIntConfig("catacombs", "autoRecomb", 0); - if (!hasKey("catacombs", "witherHelm")) writeIntConfig("catacombs", "witherHelm", 0); - if (!hasKey("catacombs", "witherChest")) writeIntConfig("catacombs", "witherChest", 0); - if (!hasKey("catacombs", "witherLegging")) writeIntConfig("catacombs", "witherLegging", 0); - if (!hasKey("catacombs", "witherBoot")) writeIntConfig("catacombs", "witherBoot", 0); - if (!hasKey("catacombs", "floorSevenCoins")) writeDoubleConfig("catacombs", "floorSevenCoins", 0); - if (!hasKey("catacombs", "floorSevenTime")) writeDoubleConfig("catacombs", "floorSevenTime", 0); - - if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); - if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false); - if (!hasKey("misc", "skill50Time")) writeIntConfig("misc", "skill50Time", 3); - if (!hasKey("misc", "cakeTime")) writeDoubleConfig("misc", "cakeTime", 0); - if (!hasKey("misc", "showSkillTracker")) writeBooleanConfig("misc", "showSkillTracker", false); - if (!hasKey("misc", "firstLaunch")) writeBooleanConfig("misc", "firstLaunch", true); + public static int initInt(String category, String key, int defaultValue) { + if (!hasKey(category, key)) { + writeIntConfig(category, key, defaultValue); + return defaultValue; + } else { + return getInt(category, key); + } + } - ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); - int height = scaled.getScaledHeight(); - if (!hasKey("locations", "coordsX")) writeIntConfig("locations", "coordsX", 5); - if (!hasKey("locations", "coordsY")) writeIntConfig("locations", "coordsY", height - 25); - if (!hasKey("locations", "displayX")) writeIntConfig("locations", "displayX", 80); - if (!hasKey("locations", "displayY")) writeIntConfig("locations", "displayY", 5); - if (!hasKey("locations", "dungeonTimerX")) writeIntConfig("locations", "dungeonTimerX", 5); - if (!hasKey("locations", "dungeonTimerY")) writeIntConfig("locations", "dungeonTimerY", 5); - if (!hasKey("locations", "skill50X")) writeIntConfig("locations", "skill50X", 40); - if (!hasKey("locations", "skill50Y")) writeIntConfig("locations", "skill50Y", 10); - if (!hasKey("locations", "lividHpX")) writeIntConfig("locations", "lividHpX", 40); - if (!hasKey("locations", "lividHpY")) writeIntConfig("locations", "lividHpY", 20); - if (!hasKey("locations", "cakeTimerX")) writeIntConfig("locations", "cakeTimerX", 40); - if (!hasKey("locations", "cakeTimerY")) writeIntConfig("locations", "cakeTimerY", 30); - if (!hasKey("locations", "skillTrackerX")) writeIntConfig("locations", "skillTrackerX", 40); - if (!hasKey("locations", "skillTrackerY")) writeIntConfig("locations", "skillTrackerY", 50); - if (!hasKey("locations", "waterAnswerX")) writeIntConfig("locations", "waterAnswerX", 100); - if (!hasKey("locations", "waterAnswerY")) writeIntConfig("locations", "waterAnswerY", 100); - if (!hasKey("locations", "bonzoTimerX")) writeIntConfig("locations", "bonzoTimerX", 40); - if (!hasKey("locations", "bonzoTimerY")) writeIntConfig("locations", "bonzoTimerY", 80); - if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); - if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); - if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); - if (!hasKey("scales", "skill50Scale")) writeDoubleConfig("scales", "skill50Scale", 1); - if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); - if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); - if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); - if (!hasKey("scales", "waterAnswerScale")) writeDoubleConfig("scales", "waterAnswerScale", 1); - if (!hasKey("scales", "bonzoTimerScale")) writeDoubleConfig("scales", "bonzoTimerScale", 1); + public static double initDouble(String category, String key, double defaultValue) { + if (!hasKey(category, key)) { + writeDoubleConfig(category, key, defaultValue); + return defaultValue; + } else { + return getDouble(category, key); + } + } - if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); - if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); - if (!hasKey("colors", "error")) writeStringConfig("colors", "error", EnumChatFormatting.RED.toString()); - if (!hasKey("colors", "type")) writeStringConfig("colors", "type", EnumChatFormatting.GREEN.toString()); - if (!hasKey("colors", "value")) writeStringConfig("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "skillAverage")) writeStringConfig("colors", "skillAverage", EnumChatFormatting.GOLD.toString()); - if (!hasKey("colors", "answer")) writeStringConfig("colors", "answer", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "skill50Display")) writeStringConfig("colors", "skill50Display", EnumChatFormatting.AQUA.toString()); - if (!hasKey("colors", "coordsDisplay")) writeStringConfig("colors", "coordsDisplay", EnumChatFormatting.WHITE.toString()); - if (!hasKey("colors", "cakeDisplay")) writeStringConfig("colors", "cakeDisplay", EnumChatFormatting.GOLD.toString()); - if (!hasKey("colors", "skillTracker")) writeStringConfig("colors", "skillTracker", EnumChatFormatting.AQUA.toString()); - if (!hasKey("colors", "triviaWrongAnswer")) writeStringConfig("colors", "triviaWrongAnswer", EnumChatFormatting.RED.toString()); - if (!hasKey("colors", "bonzoDisplay")) writeStringConfig("colors", "bonzoDisplay", EnumChatFormatting.RED.toString()); - if (!hasKey("colors", "blazeLowest")) writeIntConfig("colors", "blazeLowest", 0xFF0000); - if (!hasKey("colors", "blazeHighest")) writeIntConfig("colors", "blazeHighest", 0x40FF40); - if (!hasKey("colors", "pet1To9")) writeIntConfig("colors", "pet1To9", 0x999999); // Gray - if (!hasKey("colors", "pet10To19")) writeIntConfig("colors", "pet10To19", 0xD62440); // Red - if (!hasKey("colors", "pet20To29")) writeIntConfig("colors", "pet20To29", 0xEF5230); // Orange - if (!hasKey("colors", "pet30To39")) writeIntConfig("colors", "pet30To39", 0xFFC400); // Yellow - if (!hasKey("colors", "pet40To49")) writeIntConfig("colors", "pet40To49", 0x0EAC35); // Green - if (!hasKey("colors", "pet50To59")) writeIntConfig("colors", "pet50To59", 0x008AD8); // Light Blue - if (!hasKey("colors", "pet60To69")) writeIntConfig("colors", "pet60To69", 0x7E4FC6); // Purple - if (!hasKey("colors", "pet70To79")) writeIntConfig("colors", "pet70To79", 0xD64FC8); // Pink - if (!hasKey("colors", "pet80To89")) writeIntConfig("colors", "pet80To89", 0x5C1F35); // idk weird magenta - if (!hasKey("colors", "pet90To99")) writeIntConfig("colors", "pet90To99", 0x9E794E); // Brown - if (!hasKey("colors", "pet100")) writeIntConfig("colors", "pet100", 0xF2D249); // Gold - if (!hasKey("colors", "ultrasequencerNext")) writeIntConfig("colors", "ultrasequencerNext", 0x40FF40); - if (!hasKey("colors", "ultrasequencerNextToNext")) writeIntConfig("colors", "ultrasequencerNextToNext", 0x40DAE6); - if (!hasKey("colors", "chronomatronNext")) writeIntConfig("colors", "chronomatronNext", 0x40FF40); - if (!hasKey("colors", "chronomatronNextToNext")) writeIntConfig("colors", "chronomatronNextToNext", 0x40DAE6); - if (!hasKey("colors", "clickInOrderNext")) writeIntConfig("colors", "clickInOrderNext", 0xFF00DD); - if (!hasKey("colors", "clickInOrderNextToNext")) writeIntConfig("colors", "clickInOrderNextToNext", 0x0BEFE7); + public static String initString(String category, String key, String defaultValue) { + if (!hasKey(category, key)) { + writeStringConfig(category, key, defaultValue); + return defaultValue; + } else { + return getString(category, key); + } + } - // Commands - if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); - - ToggleCommand.gpartyToggled = getBoolean("toggles", "GParty"); - ToggleCommand.coordsToggled = getBoolean("toggles", "Coords"); - ToggleCommand.goldenToggled = getBoolean("toggles", "Golden"); - ToggleCommand.slayerCountTotal = getBoolean("toggles", "SlayerCount"); - ToggleCommand.rngesusAlerts = getBoolean("toggles", "RNGesusAlerts"); - ToggleCommand.splitFishing = getBoolean("toggles", "SplitFishing"); - ToggleCommand.chatMaddoxToggled = getBoolean("toggles", "ChatMaddox"); - ToggleCommand.spiritBearAlerts = getBoolean("toggles", "SpiritBearAlerts"); - ToggleCommand.aotdToggled = getBoolean("toggles", "AOTD"); - ToggleCommand.lividDaggerToggled = getBoolean("toggles", "LividDagger"); - ToggleCommand.petColoursToggled = getBoolean("toggles", "PetColors"); - ToggleCommand.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); - ToggleCommand.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); - ToggleCommand.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); - ToggleCommand.outlineTextToggled = getBoolean("toggles", "OutlineText"); - ToggleCommand.cakeTimerToggled = getBoolean("toggles", "CakeTimer"); + public static boolean initBoolean(String category, String key, boolean defaultValue) { + if (!hasKey(category, key)) { + writeBooleanConfig(category, key, defaultValue); + return defaultValue; + } else { + return getBoolean(category, key); + } + } + + public static void reloadConfig() { + // Toggles + ToggleCommand.gpartyToggled = initBoolean("toggles", "GParty", false); + ToggleCommand.coordsToggled = initBoolean("toggles", "Coords", false); + ToggleCommand.goldenToggled = initBoolean("toggles", "Golden", false); + ToggleCommand.slayerCountTotal = initBoolean("toggles", "SlayerCount", true); + ToggleCommand.rngesusAlerts = initBoolean("toggles", "RNGesusAlerts", false); + ToggleCommand.splitFishing = initBoolean("toggles", "SplitFishing", true); + ToggleCommand.chatMaddoxToggled = initBoolean("toggles", "ChatMaddox", false); + ToggleCommand.spiritBearAlerts = initBoolean("toggles", "SpiritBearAlerts", false); + ToggleCommand.aotdToggled = initBoolean("toggles", "AOTD", false); + ToggleCommand.lividDaggerToggled = initBoolean("toggles", "LividDagger", false); + ToggleCommand.petColoursToggled = initBoolean("toggles", "PetColors", false); + ToggleCommand.golemAlertToggled = initBoolean("toggles", "GolemAlerts", false); + ToggleCommand.expertiseLoreToggled = initBoolean("toggles", "ExpertiseLore", false); + ToggleCommand.skill50DisplayToggled = initBoolean("toggles", "Skill50Display", false); + ToggleCommand.outlineTextToggled = initBoolean("toggles", "OutlineText", false); + ToggleCommand.cakeTimerToggled = initBoolean("toggles", "CakeTimer", false); // Chat Messages - ToggleCommand.sceptreMessages = getBoolean("toggles", "SceptreMessages"); - ToggleCommand.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); - ToggleCommand.implosionMessages = getBoolean("toggles", "ImplosionMessages"); - ToggleCommand.healMessages = getBoolean("toggles", "HealMessages"); - ToggleCommand.cooldownMessages = getBoolean("toggles", "CooldownMessages"); - ToggleCommand.manaMessages = getBoolean("toggles", "ManaMessages"); + 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); //Dungeons - ToggleCommand.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); - ToggleCommand.lowHealthNotifyToggled = getBoolean("toggles", "LowHealthNotify"); - ToggleCommand.lividSolverToggled = getBoolean("toggles", "LividSolver"); - ToggleCommand.stopSalvageStarredToggled = getBoolean("toggles", "StopSalvageStarred"); - ToggleCommand.watcherReadyToggled = getBoolean("toggles", "WatcherReadyMessage"); - ToggleCommand.notifySlayerSlainToggled = getBoolean("toggles", "NotifySlayerSlain"); - ToggleCommand.necronNotificationsToggled = getBoolean("toggles", "NecronNotifications"); - ToggleCommand.bonzoTimerToggled = getBoolean("toggles", "BonzoTimer"); - ToggleCommand.swapToPickBlockToggled = getBoolean("toggles", "PickBlock"); - ToggleCommand.flowerWeaponsToggled = getBoolean("toggles", "FlowerWeapons"); - ToggleCommand.autoSkillTrackerToggled = getBoolean("toggles", "AutoSkillTracker"); + ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "DungeonTimer", false); + ToggleCommand.lowHealthNotifyToggled = initBoolean("toggles", "LowHealthNotify", false); + ToggleCommand.lividSolverToggled = initBoolean("toggles", "LividSolver", false); + ToggleCommand.stopSalvageStarredToggled = initBoolean("toggles", "StopSalvageStarred", false); + ToggleCommand.watcherReadyToggled = initBoolean("toggles", "WatcherReadyMessage", false); + ToggleCommand.notifySlayerSlainToggled = initBoolean("toggles", "NotifySlayerSlain", false); + ToggleCommand.necronNotificationsToggled = initBoolean("toggles", "NecronNotifications", false); + ToggleCommand.bonzoTimerToggled = initBoolean("toggles", "BonzoTimer", false); + ToggleCommand.swapToPickBlockToggled = initBoolean("toggles", "PickBlock", false); + ToggleCommand.flowerWeaponsToggled = initBoolean("toggles", "FlowerWeapons", false); + ToggleCommand.autoSkillTrackerToggled = initBoolean("toggles", "AutoSkillTracker", false); // Puzzle Solvers - ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); - ToggleCommand.oruoToggled = getBoolean("toggles", "OruoPuzzle"); - ToggleCommand.blazeToggled = getBoolean("toggles", "BlazePuzzle"); - ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); - ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); - ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); - ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); - ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); - ToggleCommand.clickInOrderToggled = getBoolean("toggles", "ClickInOrderTerminal"); - ToggleCommand.blockWrongTerminalClicksToggled = getBoolean("toggles", "BlockWrongTerminalClicks"); - ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); + ToggleCommand.threeManToggled = initBoolean("toggles", "ThreeManPuzzle", false); + ToggleCommand.oruoToggled = initBoolean("toggles", "OruoPuzzle", false); + ToggleCommand.blazeToggled = initBoolean("toggles", "BlazePuzzle", false); + ToggleCommand.creeperToggled = initBoolean("toggles", "CreeperPuzzle", false); + ToggleCommand.waterToggled = initBoolean("toggles", "WaterPuzzle", false); + ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); + ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); + ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); + ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); + ToggleCommand.blockWrongTerminalClicksToggled = initBoolean("toggles", "BlockWrongTerminalClicks", false); + ToggleCommand.itemFrameOnSeaLanternsToggled = initBoolean("toggles", "IgnoreItemFrameOnSeaLanterns", false); // Experiment Solvers - ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); - ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron"); - ToggleCommand.superpairsToggled = getBoolean("toggles", "Superpairs"); - ToggleCommand.hideTooltipsInExperimentAddonsToggled = getBoolean("toggles", "HideTooltipsInExperimentAddons"); + ToggleCommand.ultrasequencerToggled = initBoolean("toggles", "UltraSequencer", false); + ToggleCommand.chronomatronToggled = initBoolean("toggles", "Chronomatron", false); + ToggleCommand.superpairsToggled = initBoolean("toggles", "Superpairs", false); + ToggleCommand.hideTooltipsInExperimentAddonsToggled = initBoolean("toggles", "HideTooltipsInExperimentAddons", false); + + // API + if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); + // Block Wrong Slayer + if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { BlockWrongSlayer.onlySlayerName = onlySlayer.substring(0, onlySlayer.lastIndexOf(" ")); @@ -525,235 +275,242 @@ public class ConfigHandler { } // Wolf - LootTracker.wolfSvens = getInt("wolf", "svens"); - LootTracker.wolfTeeth = getInt("wolf", "teeth"); - LootTracker.wolfWheels = getInt("wolf", "wheel"); - LootTracker.wolfWheelsDrops = getInt("wolf", "wheelDrops"); - LootTracker.wolfSpirits = getInt("wolf", "spirit"); - LootTracker.wolfBooks = getInt("wolf", "book"); - LootTracker.wolfEggs = getInt("wolf", "egg"); - LootTracker.wolfCoutures = getInt("wolf", "couture"); - LootTracker.wolfBaits = getInt("wolf", "bait"); - LootTracker.wolfFluxes = getInt("wolf", "flux"); - LootTracker.wolfTime = getDouble("wolf", "timeRNG"); - LootTracker.wolfBosses = getInt("wolf", "bossRNG"); + LootTracker.wolfSvens = initInt("wolf", "svens", 0); + LootTracker.wolfTeeth = initInt("wolf", "teeth", 0); + LootTracker.wolfWheels = initInt("wolf", "wheel", 0); + LootTracker.wolfWheelsDrops = initInt("wolf", "wheelDrops", 0); + LootTracker.wolfSpirits = initInt("wolf", "spirit", 0); + LootTracker.wolfBooks = initInt("wolf", "book", 0); + LootTracker.wolfEggs = initInt("wolf", "egg", 0); + LootTracker.wolfCoutures = initInt("wolf", "couture", 0); + LootTracker.wolfBaits = initInt("wolf", "bait", 0); + LootTracker.wolfFluxes = initInt("wolf", "flux", 0); + LootTracker.wolfTime = initDouble("wolf", "timeRNG", -1); + LootTracker.wolfBosses = initInt("wolf", "bossRNG", -1); // Spider - LootTracker.spiderTarantulas = getInt("spider", "tarantulas"); - LootTracker.spiderWebs = getInt("spider", "web"); - LootTracker.spiderTAP = getInt("spider", "tap"); - LootTracker.spiderTAPDrops = getInt("spider", "tapDrops"); - LootTracker.spiderBites = getInt("spider", "bite"); - LootTracker.spiderCatalysts = getInt("spider", "catalyst"); - LootTracker.spiderBooks = getInt("spider", "book"); - LootTracker.spiderSwatters = getInt("spider", "swatter"); - LootTracker.spiderTalismans = getInt("spider", "talisman"); - LootTracker.spiderMosquitos = getInt("spider", "mosquito"); - LootTracker.spiderTime = getDouble("spider", "timeRNG"); - LootTracker.spiderBosses = getInt("spider", "bossRNG"); + LootTracker.spiderTarantulas = initInt("spider", "tarantulas", 0); + LootTracker.spiderWebs = initInt("spider", "web", 0); + LootTracker.spiderTAP = initInt("spider", "tap", 0); + LootTracker.spiderTAPDrops = initInt("spider", "tapDrops", 0); + LootTracker.spiderBites = initInt("spider", "bite", 0); + LootTracker.spiderCatalysts = initInt("spider", "catalyst", 0); + LootTracker.spiderBooks = initInt("spider", "book", 0); + LootTracker.spiderSwatters = initInt("spider", "swatter", 0); + LootTracker.spiderTalismans = initInt("spider", "talisman", 0); + LootTracker.spiderMosquitos = initInt("spider", "mosquito", 0); + LootTracker.spiderTime = initDouble("spider", "timeRNG", -1); + LootTracker.spiderBosses = initInt("spider", "bossRNG", -1); // Zombie - LootTracker.zombieRevs = getInt("zombie", "revs"); - LootTracker.zombieRevFlesh = getInt("zombie", "revFlesh"); - LootTracker.zombieFoulFlesh = getInt("zombie", "foulFlesh"); - LootTracker.zombieFoulFleshDrops = getInt("zombie", "foulFleshDrops"); - LootTracker.zombiePestilences = getInt("zombie", "pestilence"); - LootTracker.zombieUndeadCatas = getInt("zombie", "undeadCatalyst"); - LootTracker.zombieBooks = getInt("zombie", "book"); - LootTracker.zombieBeheadeds = getInt("zombie", "beheaded"); - LootTracker.zombieRevCatas = getInt("zombie", "revCatalyst"); - LootTracker.zombieSnakes = getInt("zombie", "snake"); - LootTracker.zombieScythes = getInt("zombie", "scythe"); - LootTracker.zombieTime = getDouble("zombie", "timeRNG"); - LootTracker.zombieBosses = getInt("zombie", "bossRNG"); + LootTracker.zombieRevs = initInt("zombie", "revs", 0); + LootTracker.zombieRevFlesh = initInt("zombie", "revFlesh", 0); + LootTracker.zombieFoulFlesh = initInt("zombie", "foulFlesh", 0); + LootTracker.zombieFoulFleshDrops = initInt("zombie", "foulFleshDrops", 0); + LootTracker.zombiePestilences = initInt("zombie", "pestilence", 0); + LootTracker.zombieUndeadCatas = initInt("zombie", "undeadCatalyst", 0); + LootTracker.zombieBooks = initInt("zombie", "book", 0); + LootTracker.zombieBeheadeds = initInt("zombie", "beheaded", 0); + LootTracker.zombieRevCatas = initInt("zombie", "revCatalyst", 0); + LootTracker.zombieSnakes = initInt("zombie", "snake", 0); + LootTracker.zombieScythes = initInt("zombie", "scythe", 0); + LootTracker.zombieTime = initDouble("zombie", "timeRNG", -1); + LootTracker.zombieBosses = initInt("zombie", "bossRNG", -1); // Fishing - LootTracker.seaCreatures = getInt("fishing", "seaCreature"); - LootTracker.goodCatches = getInt("fishing", "goodCatch"); - LootTracker.greatCatches = getInt("fishing", "greatCatch"); - LootTracker.squids = getInt("fishing", "squid"); - LootTracker.seaWalkers = getInt("fishing", "seaWalker"); - LootTracker.nightSquids = getInt("fishing", "nightSquid"); - LootTracker.seaGuardians = getInt("fishing", "seaGuardian"); - LootTracker.seaWitches = getInt("fishing", "seaWitch"); - LootTracker.seaArchers = getInt("fishing", "seaArcher"); - LootTracker.monsterOfTheDeeps = getInt("fishing", "monsterOfDeep"); - LootTracker.catfishes = getInt("fishing", "catfish"); - LootTracker.carrotKings = getInt("fishing", "carrotKing"); - LootTracker.seaLeeches = getInt("fishing", "seaLeech"); - LootTracker.guardianDefenders = getInt("fishing", "guardianDefender"); - LootTracker.deepSeaProtectors = getInt("fishing", "deepSeaProtector"); - LootTracker.hydras = getInt("fishing", "hydra"); - LootTracker.seaEmperors = getInt("fishing", "seaEmperor"); - LootTracker.empTime = getDouble("fishing", "empTime"); - LootTracker.empSCs = getInt("fishing", "empSC"); - LootTracker.fishingMilestone = getInt("fishing", "milestone"); + LootTracker.seaCreatures = initInt("fishing", "seaCreature", 0); + LootTracker.goodCatches = initInt("fishing", "goodCatch", 0); + LootTracker.greatCatches = initInt("fishing", "greatCatch", 0); + LootTracker.squids = initInt("fishing", "squid", 0); + LootTracker.seaWalkers = initInt("fishing", "seaWalker", 0); + LootTracker.nightSquids = initInt("fishing", "nightSquid", 0); + LootTracker.seaGuardians = initInt("fishing", "seaGuardian", 0); + LootTracker.seaWitches = initInt("fishing", "seaWitch", 0); + LootTracker.seaArchers = initInt("fishing", "seaArcher", 0); + LootTracker.monsterOfTheDeeps = initInt("fishing", "monsterOfDeep", 0); + LootTracker.catfishes = initInt("fishing", "catfish", 0); + LootTracker.carrotKings = initInt("fishing", "carrotKing", 0); + LootTracker.seaLeeches = initInt("fishing", "seaLeech", 0); + LootTracker.guardianDefenders = initInt("fishing", "guardianDefender", 0); + LootTracker.deepSeaProtectors = initInt("fishing", "deepSeaProtector", 0); + LootTracker.hydras = initInt("fishing", "hydra", 0); + LootTracker.seaEmperors = initInt("fishing", "seaEmperor", 0); + LootTracker.empTime = initDouble("fishing", "empTime", -1); + LootTracker.empSCs = initInt("fishing", "empSC", -1); + LootTracker.fishingMilestone = initInt("fishing", "milestone", 0); // Fishing Winter - LootTracker.frozenSteves = getInt("fishing", "frozenSteve"); - LootTracker.frostyTheSnowmans = getInt("fishing", "snowman"); - LootTracker.grinches = getInt("fishing", "grinch"); - LootTracker.yetis = getInt("fishing", "yeti"); - LootTracker.yetiTime = getDouble("fishing", "yetiTime"); - LootTracker.yetiSCs = getInt("fishing", "yetiSC"); + LootTracker.frozenSteves = initInt("fishing", "frozenSteve", 0); + LootTracker.frostyTheSnowmans = initInt("fishing", "snowman", 0); + LootTracker.grinches = initInt("fishing", "grinch", 0); + LootTracker.yetis = initInt("fishing", "yeti", 0); + LootTracker.yetiTime = initDouble("fishing", "yetiTime", -1); + LootTracker.yetiSCs = initInt("fishing", "yetiSC", -1); // Fishing Festival - LootTracker.nurseSharks = getInt("fishing", "nurseShark"); - LootTracker.blueSharks = getInt("fishing", "blueShark"); - LootTracker.tigerSharks = getInt("fishing", "tigerShark"); - LootTracker.greatWhiteSharks = getInt("fishing", "greatWhiteShark"); + LootTracker.nurseSharks = initInt("fishing", "nurseShark", 0); + LootTracker.blueSharks = initInt("fishing", "blueShark", 0); + LootTracker.tigerSharks = initInt("fishing", "tigerShark", 0); + LootTracker.greatWhiteSharks = initInt("fishing", "greatWhiteShark", 0); // Spooky Fishing - LootTracker.scarecrows = getInt("fishing", "scarecrow"); - LootTracker.nightmares = getInt("fishing", "nightmare"); - LootTracker.werewolfs = getInt("fishing", "werewolf"); - LootTracker.phantomFishers = getInt("fishing", "phantomFisher"); - LootTracker.grimReapers = getInt("fishing", "grimReaper"); + LootTracker.scarecrows = initInt("fishing", "scarecrow", 0); + LootTracker.nightmares = initInt("fishing", "nightmare", 0); + LootTracker.werewolfs = initInt("fishing", "werewolf", 0); + LootTracker.phantomFishers = initInt("fishing", "phantomFisher", 0); + LootTracker.grimReapers = initInt("fishing", "grimReaper", 0); // Mythological - LootTracker.mythCoins = getDouble("mythological", "coins"); - LootTracker.griffinFeathers = getInt("mythological", "griffinFeather"); - LootTracker.crownOfGreeds = getInt("mythological", "crownOfGreed"); - LootTracker.washedUpSouvenirs = getInt("mythological", "washedUpSouvenir"); - LootTracker.minosHunters = getInt("mythological", "minosHunter"); - LootTracker.siameseLynxes = getInt("mythological", "siameseLynx"); - LootTracker.minotaurs = getInt("mythological", "minotaur"); - LootTracker.gaiaConstructs = getInt("mythological", "gaiaConstruct"); - LootTracker.minosChampions = getInt("mythological", "minosChampion"); - LootTracker.minosInquisitors = getInt("mythological", "minosInquisitor"); + LootTracker.mythCoins = initDouble("mythological", "coins", 0); + LootTracker.griffinFeathers = initInt("mythological", "griffinFeather", 0); + LootTracker.crownOfGreeds = initInt("mythological", "crownOfGreed", 0); + LootTracker.washedUpSouvenirs = initInt("mythological", "washedUpSouvenir", 0); + LootTracker.minosHunters = initInt("mythological", "minosHunter", 0); + LootTracker.siameseLynxes = initInt("mythological", "siameseLynx", 0); + LootTracker.minotaurs = initInt("mythological", "minotaur", 0); + LootTracker.gaiaConstructs = initInt("mythological", "gaiaConstruct", 0); + LootTracker.minosChampions = initInt("mythological", "minosChampion", 0); + LootTracker.minosInquisitors = initInt("mythological", "minosInquisitor", 0); // Dungeons - LootTracker.recombobulators = getInt("catacombs", "recombobulator"); - LootTracker.fumingPotatoBooks = getInt("catacombs", "fumingBooks"); + LootTracker.recombobulators = initInt("catacombs", "recombobulator", 0); + LootTracker.fumingPotatoBooks = initInt("catacombs", "fumingBooks", 0); // F1 - LootTracker.bonzoStaffs = getInt("catacombs", "bonzoStaff"); - LootTracker.f1CoinsSpent = getDouble("catacombs", "floorOneCoins"); - LootTracker.f1TimeSpent = getDouble("catacombs", "floorOneTime"); + LootTracker.bonzoStaffs = initInt("catacombs", "bonzoStaff", 0); + LootTracker.f1CoinsSpent = initDouble("catacombs", "floorOneCoins", 0); + LootTracker.f1TimeSpent = initDouble("catacombs", "floorOneTime", 0); // F2 - LootTracker.scarfStudies = getInt("catacombs", "scarfStudies"); - LootTracker.f2CoinsSpent = getDouble("catacombs", "floorTwoCoins"); - LootTracker.f2TimeSpent = getDouble("catacombs", "floorTwoTime"); + LootTracker.scarfStudies = initInt("catacombs", "scarfStudies", 0); + LootTracker.f2CoinsSpent = initDouble("catacombs", "floorTwoCoins", 0); + LootTracker.f2TimeSpent = initDouble("catacombs", "floorTwoTime", 0); // F3 - LootTracker.adaptiveHelms = getInt("catacombs", "adaptiveHelm"); - LootTracker.adaptiveChests = getInt("catacombs", "adaptiveChest"); - LootTracker.adaptiveLegs = getInt("catacombs", "adaptiveLegging"); - LootTracker.adaptiveBoots = getInt("catacombs", "adaptiveBoot"); - LootTracker.adaptiveSwords = getInt("catacombs", "adaptiveSword"); - LootTracker.f3CoinsSpent = getDouble("catacombs", "floorThreeCoins"); - LootTracker.f3TimeSpent = getDouble("catacombs", "floorThreeTime"); + LootTracker.adaptiveHelms = initInt("catacombs", "adaptiveHelm", 0); + LootTracker.adaptiveChests = initInt("catacombs", "adaptiveChest", 0); + LootTracker.adaptiveLegs = initInt("catacombs", "adaptiveLegging", 0); + LootTracker.adaptiveBoots = initInt("catacombs", "adaptiveBoot", 0); + LootTracker.adaptiveSwords = initInt("catacombs", "adaptiveSword", 0); + LootTracker.f3CoinsSpent = initDouble("catacombs", "floorThreeCoins", 0); + LootTracker.f3TimeSpent = initDouble("catacombs", "floorThreeTime", 0); // F4 - LootTracker.spiritWings = getInt("catacombs", "spiritWing"); - LootTracker.spiritBones = getInt("catacombs", "spiritBone"); - LootTracker.spiritBoots = getInt("catacombs", "spiritBoot"); - LootTracker.spiritSwords = getInt("catacombs", "spiritSword"); - LootTracker.spiritBows = getInt("catacombs", "spiritBow"); - LootTracker.epicSpiritPets = getInt("catacombs", "spiritPetEpic"); - LootTracker.legSpiritPets = getInt("catacombs", "spiritPetLeg"); - LootTracker.f4CoinsSpent = getDouble("catacombs", "floorFourCoins"); - LootTracker.f4TimeSpent = getDouble("catacombs", "floorFourTime"); + LootTracker.spiritWings = initInt("catacombs", "spiritWing", 0); + LootTracker.spiritBones = initInt("catacombs", "spiritBone", 0); + LootTracker.spiritBoots = initInt("catacombs", "spiritBoot", 0); + LootTracker.spiritSwords = initInt("catacombs", "spiritSword", 0); + LootTracker.spiritBows = initInt("catacombs", "spiritBow", 0); + LootTracker.epicSpiritPets = initInt("catacombs", "spiritPetEpic", 0); + LootTracker.legSpiritPets = initInt("catacombs", "spiritPetLeg", 0); + LootTracker.f4CoinsSpent = initDouble("catacombs", "floorFourCoins", 0); + LootTracker.f4TimeSpent = initDouble("catacombs", "floorFourTime", 0); // F5 - LootTracker.warpedStones = getInt("catacombs", "warpedStone"); - LootTracker.shadowAssHelms = getInt("catacombs", "shadowAssassinHelm"); - LootTracker.shadowAssChests = getInt("catacombs", "shadowAssassinChest"); - LootTracker.shadowAssLegs = getInt("catacombs", "shadowAssassinLegging"); - LootTracker.shadowAssBoots = getInt("catacombs", "shadowAssassinBoot"); - LootTracker.lastBreaths = getInt("catacombs", "lastBreath"); - LootTracker.lividDaggers = getInt("catacombs", "lividDagger"); - LootTracker.shadowFurys = getInt("catacombs", "shadowFury"); - LootTracker.f5CoinsSpent = getDouble("catacombs", "floorFiveCoins"); - LootTracker.f5TimeSpent = getDouble("catacombs", "floorFiveTime"); + LootTracker.warpedStones = initInt("catacombs", "warpedStone", 0); + LootTracker.shadowAssHelms = initInt("catacombs", "shadowAssassinHelm", 0); + LootTracker.shadowAssChests = initInt("catacombs", "shadowAssassinChest", 0); + LootTracker.shadowAssLegs = initInt("catacombs", "shadowAssassinLegging", 0); + LootTracker.shadowAssBoots = initInt("catacombs", "shadowAssassinBoot", 0); + LootTracker.lastBreaths = initInt("catacombs", "lastBreath", 0); + LootTracker.lividDaggers = initInt("catacombs", "lividDagger", 0); + LootTracker.shadowFurys = initInt("catacombs", "shadowFury", 0); + LootTracker.f5CoinsSpent = initDouble("catacombs", "floorFiveCoins", 0); + LootTracker.f5TimeSpent = initDouble("catacombs", "floorFiveTime", 0); // F6 - LootTracker.ancientRoses = getInt("catacombs", "ancientRose"); - LootTracker.precursorEyes = getInt("catacombs", "precursorEye"); - LootTracker.giantsSwords = getInt("catacombs", "giantsSword"); - LootTracker.necroLordHelms = getInt("catacombs", "necroLordHelm"); - LootTracker.necroLordChests = getInt("catacombs", "necroLordChest"); - LootTracker.necroLordLegs = getInt("catacombs", "necroLordLegging"); - LootTracker.necroLordBoots = getInt("catacombs", "necroLordBoot"); - LootTracker.necroSwords = getInt("catacombs", "necroSword"); - LootTracker.f6CoinsSpent = getDouble("catacombs", "floorSixCoins"); - LootTracker.f6TimeSpent = getDouble("catacombs", "floorSixTime"); + LootTracker.ancientRoses = initInt("catacombs", "ancientRose", 0); + LootTracker.precursorEyes = initInt("catacombs", "precursorEye", 0); + LootTracker.giantsSwords = initInt("catacombs", "giantsSword", 0); + LootTracker.necroLordHelms = initInt("catacombs", "necroLordHelm", 0); + LootTracker.necroLordChests = initInt("catacombs", "necroLordChest", 0); + LootTracker.necroLordLegs = initInt("catacombs", "necroLordLegging", 0); + LootTracker.necroLordBoots = initInt("catacombs", "necroLordBoot", 0); + LootTracker.necroSwords = initInt("catacombs", "necroSword", 0); + LootTracker.f6CoinsSpent = initDouble("catacombs", "floorSixCoins", 0); + LootTracker.f6TimeSpent = initDouble("catacombs", "floorSixTime", 0); // F7 - LootTracker.witherBloods = getInt("catacombs", "witherBlood"); - LootTracker.witherCloaks = getInt("catacombs", "witherCloak"); - LootTracker.implosions = getInt("catacombs", "implosion"); - LootTracker.witherShields = getInt("catacombs", "witherShield"); - LootTracker.shadowWarps = getInt("catacombs", "shadowWarp"); - LootTracker.necronsHandles = getInt("catacombs", "necronsHandle"); - LootTracker.autoRecombs = getInt("catacombs", "autoRecomb"); - LootTracker.witherHelms = getInt("catacombs", "witherHelm"); - LootTracker.witherChests = getInt("catacombs", "witherChest"); - LootTracker.witherLegs = getInt("catacombs", "witherLegging"); - LootTracker.witherBoots = getInt("catacombs", "witherBoot"); - LootTracker.f7CoinsSpent = getDouble("catacombs", "floorSevenCoins"); - LootTracker.f7TimeSpent = getDouble("catacombs", "floorSevenTime"); + LootTracker.witherBloods = initInt("catacombs", "witherBlood", 0); + LootTracker.witherCloaks = initInt("catacombs", "witherCloak", 0); + LootTracker.implosions = initInt("catacombs", "implosion", 0); + LootTracker.witherShields = initInt("catacombs", "witherShield", 0); + LootTracker.shadowWarps = initInt("catacombs", "shadowWarp", 0); + LootTracker.necronsHandles = initInt("catacombs", "necronsHandle", 0); + LootTracker.autoRecombs = initInt("catacombs", "autoRecomb", 0); + LootTracker.witherHelms = initInt("catacombs", "witherHelm", 0); + LootTracker.witherChests = initInt("catacombs", "witherChest", 0); + LootTracker.witherLegs = initInt("catacombs", "witherLegging", 0); + LootTracker.witherBoots = initInt("catacombs", "witherBoot", 0); + LootTracker.f7CoinsSpent = initDouble("catacombs", "floorSevenCoins", 0); + LootTracker.f7TimeSpent = initDouble("catacombs", "floorSevenTime", 0); // Misc - DisplayCommand.display = getString("misc", "display"); - DisplayCommand.auto = getBoolean("misc", "autoDisplay"); - Skill50Display.SKILL_TIME = getInt("misc", "skill50Time") * 20; - CakeTimer.cakeTime = getDouble("misc", "cakeTime"); - SkillTracker.showSkillTracker = getBoolean("misc", "showSkillTracker"); - DankersSkyblockMod.firstLaunch = getBoolean("misc", "firstLaunch"); + LootDisplay.display = initString("misc", "display", "off"); + LootDisplay.auto = initBoolean("misc", "autoDisplay", false); + Skill50Display.SKILL_TIME = initInt("misc", "skill50Time", 3) * 20; + CakeTimer.cakeTime = initDouble("misc", "cakeTime", 0); + SkillTracker.showSkillTracker = initBoolean("misc", "showSkillTracker", false); + DankersSkyblockMod.firstLaunch = initBoolean("misc", "firstLaunch", true); - MoveCommand.coordsXY[0] = getInt("locations", "coordsX"); - MoveCommand.coordsXY[1] = getInt("locations", "coordsY"); - MoveCommand.displayXY[0] = getInt("locations", "displayX"); - MoveCommand.displayXY[1] = getInt("locations", "displayY"); - MoveCommand.dungeonTimerXY[0] = getInt("locations", "dungeonTimerX"); - MoveCommand.dungeonTimerXY[1] = getInt("locations", "dungeonTimerY"); - MoveCommand.skill50XY[0] = getInt("locations", "skill50X"); - MoveCommand.skill50XY[1] = getInt("locations", "skill50Y"); - MoveCommand.lividHpXY[0] = getInt("locations", "lividHpX"); - MoveCommand.lividHpXY[1] = getInt("locations", "lividHpY"); - MoveCommand.cakeTimerXY[0] = getInt("locations", "cakeTimerX"); - MoveCommand.cakeTimerXY[1] = getInt("locations", "cakeTimerY"); - MoveCommand.skillTrackerXY[0] = getInt("locations", "skillTrackerX"); - MoveCommand.skillTrackerXY[1] = getInt("locations", "skillTrackerY"); - MoveCommand.waterAnswerXY[0] = getInt("locations", "waterAnswerX"); - MoveCommand.waterAnswerXY[1] = getInt("locations", "waterAnswerY"); - MoveCommand.bonzoTimerXY[0] = getInt("locations", "bonzoTimerX"); - MoveCommand.bonzoTimerXY[1] = getInt("locations", "bonzoTimerY"); + // Locations + ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); + int height = scaled.getScaledHeight(); + MoveCommand.coordsXY[0] = initInt("locations", "coordsX", 5); + MoveCommand.coordsXY[1] = initInt("locations", "coordsY", height - 25); + MoveCommand.displayXY[0] = initInt("locations", "displayX", 80); + MoveCommand.displayXY[1] = initInt("locations", "displayY", 5); + MoveCommand.dungeonTimerXY[0] = initInt("locations", "dungeonTimerX", 5); + MoveCommand.dungeonTimerXY[1] = initInt("locations", "dungeonTimerY", 5); + MoveCommand.skill50XY[0] = initInt("locations", "skill50X", 40); + MoveCommand.skill50XY[1] = initInt("locations", "skill50Y", 10); + MoveCommand.lividHpXY[0] = initInt("locations", "lividHpX", 40); + MoveCommand.lividHpXY[1] = initInt("locations", "lividHpY", 20); + MoveCommand.cakeTimerXY[0] = initInt("locations", "cakeTimerX", 40); + MoveCommand.cakeTimerXY[1] = initInt("locations", "cakeTimerY", 30); + MoveCommand.skillTrackerXY[0] = initInt("locations", "skillTrackerX", 40); + MoveCommand.skillTrackerXY[1] = initInt("locations", "skillTrackerY", 50); + MoveCommand.waterAnswerXY[0] = initInt("locations", "waterAnswerX", 100); + MoveCommand.waterAnswerXY[1] = initInt("locations", "waterAnswerY", 100); + MoveCommand.bonzoTimerXY[0] = initInt("locations", "bonzoTimerX", 40); + MoveCommand.bonzoTimerXY[1] = initInt("locations", "bonzoTimerY", 80); + // Scales + ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); + ScaleCommand.displayScale = initDouble("scales", "displayScale", 1); + ScaleCommand.dungeonTimerScale = initDouble("scales", "dungeonTimerScale", 1); + ScaleCommand.skill50Scale = initDouble("scales", "skill50Scale", 1); + ScaleCommand.lividHpScale = initDouble("scales", "lividHpScale", 1); + ScaleCommand.cakeTimerScale = initDouble("scales", "cakeTimerScale", 1); + ScaleCommand.skillTrackerScale = initDouble("scales", "skillTrackerScale", 1); + ScaleCommand.waterAnswerScale = initDouble("scales", "waterAnswerScale", 1); + ScaleCommand.bonzoTimerScale = initDouble("scales", "bonzoTimerScale", 1); - ScaleCommand.coordsScale = getDouble("scales", "coordsScale"); - ScaleCommand.displayScale = getDouble("scales", "displayScale"); - ScaleCommand.dungeonTimerScale = getDouble("scales", "dungeonTimerScale"); - ScaleCommand.skill50Scale = getDouble("scales", "skill50Scale"); - ScaleCommand.lividHpScale = getDouble("scales", "lividHpScale"); - ScaleCommand.cakeTimerScale = getDouble("scales", "cakeTimerScale"); - ScaleCommand.skillTrackerScale = getDouble("scales", "skillTrackerScale"); - ScaleCommand.waterAnswerScale = getDouble("scales", "waterAnswerScale"); - ScaleCommand.bonzoTimerScale = getDouble("scales", "bonzoTimerScale"); + // Colours + DankersSkyblockMod.MAIN_COLOUR = initString("colors", "main", EnumChatFormatting.GREEN.toString()); + DankersSkyblockMod.SECONDARY_COLOUR = initString("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); + DankersSkyblockMod.DELIMITER_COLOUR = initString("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); + DankersSkyblockMod.ERROR_COLOUR = initString("colors", "error", EnumChatFormatting.RED.toString()); + DankersSkyblockMod.TYPE_COLOUR = initString("colors", "type", EnumChatFormatting.GREEN.toString()); + DankersSkyblockMod.VALUE_COLOUR = initString("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); + DankersSkyblockMod.SKILL_AVERAGE_COLOUR = initString("colors", "skillAverage", EnumChatFormatting.GOLD.toString()); + DankersSkyblockMod.ANSWER_COLOUR = initString("colors", "answer", EnumChatFormatting.DARK_GREEN.toString()); + Skill50Display.SKILL_50_COLOUR = initString("colors", "skill50Display", EnumChatFormatting.AQUA.toString()); + NoF3Coords.COORDS_COLOUR = initString("colors", "coordsDisplay", EnumChatFormatting.WHITE.toString()); + CakeTimer.CAKE_COLOUR = initString("colors", "cakeDisplay", EnumChatFormatting.GOLD.toString()); + SkillTracker.SKILL_TRACKER_COLOUR = initString("colors", "skillTracker", EnumChatFormatting.AQUA.toString()); + TriviaSolver.TRIVIA_WRONG_ANSWER_COLOUR = initString("colors", "triviaWrongAnswer", EnumChatFormatting.RED.toString()); + BonzoMaskTimer.BONZO_COLOR = initString("colors", "bonzoDisplay", EnumChatFormatting.RED.toString()); + BlazeSolver.LOWEST_BLAZE_COLOUR = initInt("colors", "blazeLowest", 0xFF0000); + BlazeSolver.HIGHEST_BLAZE_COLOUR = initInt("colors", "blazeHighest", 0x40FF40); + PetColours.PET_1_TO_9 = initInt("colors", "pet1To9", 0x999999); // Grey + PetColours.PET_10_TO_19 = initInt("colors", "pet10To19", 0xD62440); // Red + PetColours.PET_20_TO_29 = initInt("colors", "pet20To29", 0xEF5230); // Orange + PetColours.PET_30_TO_39 = initInt("colors", "pet30To39", 0xFFC400); // Yellow + PetColours.PET_40_TO_49 = initInt("colors", "pet40To49", 0x0EAC35); // Green + PetColours.PET_50_TO_59 = initInt("colors", "pet50To59", 0x008AD8); // Light Blue + PetColours.PET_60_TO_69 = initInt("colors", "pet60To69", 0x7E4FC6); // Purple + PetColours.PET_70_TO_79 = initInt("colors", "pet70To79", 0xD64FC8); // Pink + PetColours.PET_80_TO_89 = initInt("colors", "pet80To89", 0x5C1F35); // idk weird magenta + PetColours.PET_90_TO_99 = initInt("colors", "pet90To99", 0x9E794E); // Brown + PetColours.PET_100 = initInt("colors", "pet100", 0xF2D249); // Gold + UltrasequencerSolver.ULTRASEQUENCER_NEXT = initInt("colors", "ultrasequencerNext", 0x40FF40); + UltrasequencerSolver.ULTRASEQUENCER_NEXT_TO_NEXT = initInt("colors", "ultrasequencerNextToNext", 0x40DAE6); + ChronomatronSolver.CHRONOMATRON_NEXT = initInt("colors", "chronomatronNext", 0x40FF40); + ChronomatronSolver.CHRONOMATRON_NEXT_TO_NEXT = initInt("colors", "chronomatronNextToNext", 0x40DAE6); + ClickInOrderSolver.CLICK_IN_ORDER_NEXT = initInt("colors", "clickInOrderNext", 0xFF00DD); + ClickInOrderSolver.CLICK_IN_ORDER_NEXT_TO_NEXT = initInt("colors", "clickInOrderNextToNext", 0x0BEFE7); - DankersSkyblockMod.MAIN_COLOUR = getString("colors", "main"); - DankersSkyblockMod.SECONDARY_COLOUR = getString("colors", "secondary"); - DankersSkyblockMod.DELIMITER_COLOUR = getString("colors", "delimiter"); - DankersSkyblockMod.ERROR_COLOUR = getString("colors", "error"); - DankersSkyblockMod.TYPE_COLOUR = getString("colors", "type"); - DankersSkyblockMod.VALUE_COLOUR = getString("colors", "value"); - DankersSkyblockMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); - DankersSkyblockMod.ANSWER_COLOUR = getString("colors", "answer"); - Skill50Display.SKILL_50_COLOUR = getString("colors", "skill50Display"); - NoF3Coords.COORDS_COLOUR = getString("colors", "coordsDisplay"); - CakeTimer.CAKE_COLOUR = getString("colors", "cakeDisplay"); - SkillTracker.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); - TriviaSolver.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); - BonzoMaskTimer.BONZO_COLOR = getString("colors", "bonzoDisplay"); - BlazeSolver.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); - BlazeSolver.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); - PetColours.PET_1_TO_9 = getInt("colors", "pet1To9"); - PetColours.PET_10_TO_19 = getInt("colors", "pet10To19"); - PetColours.PET_20_TO_29 = getInt("colors", "pet20To29"); - PetColours.PET_30_TO_39 = getInt("colors", "pet30To39"); - PetColours.PET_40_TO_49 = getInt("colors", "pet40To49"); - PetColours.PET_50_TO_59 = getInt("colors", "pet50To59"); - PetColours.PET_60_TO_69 = getInt("colors", "pet60To69"); - PetColours.PET_70_TO_79 = getInt("colors", "pet70To79"); - PetColours.PET_80_TO_89 = getInt("colors", "pet80To89"); - PetColours.PET_90_TO_99 = getInt("colors", "pet90To99"); - PetColours.PET_100 = getInt("colors", "pet100"); - UltrasequencerSolver.ULTRASEQUENCER_NEXT = getInt("colors", "ultrasequencerNext"); - UltrasequencerSolver.ULTRASEQUENCER_NEXT_TO_NEXT = getInt("colors", "ultrasequencerNextToNext"); - ChronomatronSolver.CHRONOMATRON_NEXT = getInt("colors", "chronomatronNext"); - ChronomatronSolver.CHRONOMATRON_NEXT_TO_NEXT = getInt("colors", "chronomatronNextToNext"); - ClickInOrderSolver.CLICK_IN_ORDER_NEXT = getInt("colors", "clickInOrderNext"); - ClickInOrderSolver.CLICK_IN_ORDER_NEXT_TO_NEXT = getInt("colors", "clickInOrderNextToNext"); + // Commands + if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); } } -- cgit From e7237307e71c649b4b7c880259ff1781fcc7c435 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 4 Mar 2021 22:00:19 -0500 Subject: Add boulder puzzle solver --- README.md | 15 +- src/main/java/me/Danker/DankersSkyblockMod.java | 6 +- src/main/java/me/Danker/commands/DHelpCommand.java | 3 +- .../java/me/Danker/commands/DankerGuiCommand.java | 4 + .../java/me/Danker/commands/ToggleCommand.java | 19 +- src/main/java/me/Danker/features/AutoDisplay.java | 1 - .../java/me/Danker/features/BlockAbilities.java | 84 +++++++ .../java/me/Danker/features/loot/LootDisplay.java | 1 - .../features/puzzlesolvers/BlockAbilities.java | 84 ------- .../features/puzzlesolvers/BoulderSolver.java | 188 ++++++++++++++ .../features/puzzlesolvers/CreeperSolver.java | 2 +- .../features/puzzlesolvers/ThreeManSolver.java | 2 +- .../features/puzzlesolvers/TriviaSolver.java | 5 +- src/main/java/me/Danker/gui/DisplayGui.java | 1 - src/main/java/me/Danker/gui/PuzzleSolversGui.java | 19 +- .../java/me/Danker/handlers/ConfigHandler.java | 4 +- src/main/java/me/Danker/utils/BoulderUtils.java | 280 +++++++++++++++++++++ src/main/java/me/Danker/utils/Utils.java | 24 +- 18 files changed, 623 insertions(+), 119 deletions(-) create mode 100644 src/main/java/me/Danker/features/BlockAbilities.java delete mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java create mode 100644 src/main/java/me/Danker/utils/BoulderUtils.java (limited to 'src/main/java/me/Danker/features') diff --git a/README.md b/README.md index e96ce00..6673b43 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,11 @@ Discord Server: https://discord.gg/QsEkNQS - Click anywhere on-screen to open Maddox - Maddox menu keybind - Block starting other slayer quests +- Slayer slain alert - Fishing, jerry fishing, fishing festival, spooky fishing trackers - Expertise kills in fishing rod lore - Catacombs trackers -- Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe) +- Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe, boulder) - Dungeons timer (watcher, boss, deaths, and puzzle fails) - Watcher ready message - Catacombs F7 Stage 3 solvers (Starts with letter, select all colour, ignore arrows on sea lanterns) @@ -52,14 +53,14 @@ Discord Server: https://discord.gg/QsEkNQS ## Commands - /dhelp - Returns this message in-game. - /dsm - Opens the GUI for Danker's Skyblock Mod. -- /toggle - Toggles features. /toggle list returns values of every toggle. +- /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/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/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. -- /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. +- /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. +- /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. - /skills [player] - Uses API to get skill levels of a person. If no name is provided, it checks yours. - /lobbyskills - Uses API to find the average skills of the lobby, as well the three players with the highest skill average. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 38e956f..0920520 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -65,8 +65,8 @@ public class DankersSkyblockMod { public static String titleText = ""; public static int tickAmount = 1; public static KeyBinding[] keyBindings = new KeyBinding[3]; - static boolean usingLabymod = false; - static boolean usingOAM = false; + public static boolean usingLabymod = false; + public static boolean usingOAM = false; static boolean OAMWarning = false; public static String guiToOpen = null; public static boolean firstLaunch = false; @@ -92,6 +92,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new BlockWrongSlayer()); MinecraftForge.EVENT_BUS.register(new BlockWrongTerminalClicks()); MinecraftForge.EVENT_BUS.register(new BonzoMaskTimer()); + MinecraftForge.EVENT_BUS.register(new BoulderSolver()); MinecraftForge.EVENT_BUS.register(new CakeTimer()); MinecraftForge.EVENT_BUS.register(new ChronomatronSolver()); MinecraftForge.EVENT_BUS.register(new ClickInOrderSolver()); @@ -130,6 +131,7 @@ public class DankersSkyblockMod { ConfigHandler.reloadConfig(); GoldenEnchants.init(); + TriviaSolver.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/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index bcaf8b0..6272a60 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + @@ -54,6 +54,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + EnumChatFormatting.GOLD + " /onlyslayer <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + EnumChatFormatting.GOLD + " /skilltracker " + EnumChatFormatting.AQUA + " - Text display for skill xp/hour.\n" + + EnumChatFormatting.GOLD + " /reparty " + EnumChatFormatting.AQUA + " - Disbands and reparties all members in the party.\n" + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n" + EnumChatFormatting.GREEN + " Start/Stop Skill Tracker" + EnumChatFormatting.AQUA + " - Numpad 5 by default.\n")); } diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 5ffd754..9ba86da 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -72,6 +72,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[creeperpuzzle][").append(ToggleCommand.creeperToggled).append("]\n"); debug.append("[waterpuzzle][").append(ToggleCommand.waterToggled).append("]\n"); debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); + debug.append("[boulderpuzzle][").append(ToggleCommand.boulderToggled).append("]\n"); debug.append("[watchermessage][").append(ToggleCommand.watcherReadyToggled).append("]\n"); debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); @@ -96,6 +97,9 @@ public class DankerGuiCommand extends CommandBase { debug.append("[Current Display][").append(LootDisplay.display).append("]\n"); debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n"); debug.append("[Skill Tracker Visible][").append(SkillTracker.showSkillTracker).append("]\n"); + debug.append("# Problematic Mods\n"); + debug.append("[LabyMod][").append(DankersSkyblockMod.usingLabymod).append("]\n"); + debug.append("[OAM][").append(DankersSkyblockMod.usingOAM).append("]\n"); debug.append("# Resource Packs\n"); if (Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries().size() == 0) { debug.append("\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index b632abc..77dc82e 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -55,6 +55,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean creeperToggled; public static boolean waterToggled; public static boolean ticTacToeToggled; + public static boolean boulderToggled; // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; @@ -76,11 +77,13 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; + "aotd/lividdagger/flowerweapons/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/" + + "skill50display/outlinetext/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/" + + "manamessages/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/" + + "necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/" + + "tictactoepuzzle/boulderpuzzle/watchermessage/startswithterminal/selectallterminal/" + + "clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/" + + "chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -301,6 +304,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ticTacToeToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Tic tac toe puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ticTacToeToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "boulderpuzzle": + boulderToggled = !boulderToggled; + ConfigHandler.writeBooleanConfig("toggles", "BoulderPuzzle", boulderToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Boulder puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + boulderToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "watchermessage": watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); @@ -390,6 +398,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Creeper puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + creeperToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Water puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + waterToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Tic tac toe puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + ticTacToeToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Boulder puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + boulderToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Watcher ready message: " + DankersSkyblockMod.VALUE_COLOUR + watcherReadyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Starts with letter terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + startsWithToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Select all color items terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + selectAllToggled + "\n" + diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 5411034..876fb6a 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -1,7 +1,6 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; -import me.Danker.commands.DisplayCommand; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; diff --git a/src/main/java/me/Danker/features/BlockAbilities.java b/src/main/java/me/Danker/features/BlockAbilities.java new file mode 100644 index 0000000..19a887c --- /dev/null +++ b/src/main/java/me/Danker/features/BlockAbilities.java @@ -0,0 +1,84 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.Arrays; + +public class BlockAbilities { + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + ItemStack item = event.entityPlayer.getHeldItem(); + if (item == null) return; + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { + event.setCanceled(true); + } + if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { + event.setCanceled(true); + } + } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + + ArrayList interactables = new ArrayList<>(Arrays.asList( + Blocks.acacia_door, + Blocks.anvil, + Blocks.beacon, + Blocks.bed, + Blocks.birch_door, + Blocks.brewing_stand, + Blocks.command_block, + Blocks.crafting_table, + Blocks.chest, + Blocks.dark_oak_door, + Blocks.daylight_detector, + Blocks.daylight_detector_inverted, + Blocks.dispenser, + Blocks.dropper, + Blocks.enchanting_table, + Blocks.ender_chest, + Blocks.furnace, + Blocks.hopper, + Blocks.jungle_door, + Blocks.lever, + Blocks.noteblock, + Blocks.powered_comparator, + Blocks.unpowered_comparator, + Blocks.powered_repeater, + Blocks.unpowered_repeater, + Blocks.standing_sign, + Blocks.wall_sign, + Blocks.trapdoor, + Blocks.trapped_chest, + Blocks.wooden_button, + Blocks.stone_button, + Blocks.oak_door, + Blocks.skull + )); + if (Utils.inDungeons) { + interactables.add(Blocks.coal_block); + interactables.add(Blocks.stained_hardened_clay); + } + + if (!interactables.contains(block)) { + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { + event.setCanceled(true); + } + if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { + event.setCanceled(true); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 4013c0a..363b70c 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -1,6 +1,5 @@ package me.Danker.features.loot; -import me.Danker.commands.DisplayCommand; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java deleted file mode 100644 index 464b76a..0000000 --- a/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java +++ /dev/null @@ -1,84 +0,0 @@ -package me.Danker.features.puzzlesolvers; - -import me.Danker.commands.ToggleCommand; -import me.Danker.utils.Utils; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.ArrayList; -import java.util.Arrays; - -public class BlockAbilities { - - @SubscribeEvent - public void onInteract(PlayerInteractEvent event) { - if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; - ItemStack item = event.entityPlayer.getHeldItem(); - if (item == null) return; - - if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { - if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { - event.setCanceled(true); - } - if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { - event.setCanceled(true); - } - } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { - Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); - - ArrayList interactables = new ArrayList<>(Arrays.asList( - Blocks.acacia_door, - Blocks.anvil, - Blocks.beacon, - Blocks.bed, - Blocks.birch_door, - Blocks.brewing_stand, - Blocks.command_block, - Blocks.crafting_table, - Blocks.chest, - Blocks.dark_oak_door, - Blocks.daylight_detector, - Blocks.daylight_detector_inverted, - Blocks.dispenser, - Blocks.dropper, - Blocks.enchanting_table, - Blocks.ender_chest, - Blocks.furnace, - Blocks.hopper, - Blocks.jungle_door, - Blocks.lever, - Blocks.noteblock, - Blocks.powered_comparator, - Blocks.unpowered_comparator, - Blocks.powered_repeater, - Blocks.unpowered_repeater, - Blocks.standing_sign, - Blocks.wall_sign, - Blocks.trapdoor, - Blocks.trapped_chest, - Blocks.wooden_button, - Blocks.stone_button, - Blocks.oak_door, - Blocks.skull - )); - if (Utils.inDungeons) { - interactables.add(Blocks.coal_block); - interactables.add(Blocks.stained_hardened_clay); - } - - if (!interactables.contains(block)) { - if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { - event.setCanceled(true); - } - if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { - event.setCanceled(true); - } - } - } - } - -} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java new file mode 100644 index 0000000..0089038 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java @@ -0,0 +1,188 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.BoulderUtils; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class BoulderSolver { + + static boolean prevInBoulderRoom = false; + static boolean inBoulderRoom = false; + static BlockPos chest = null; + static String boulderRoomDirection = null; + public static List route = new ArrayList<>(); + static int currentStep = 0; + public static int BOULDER_COLOUR; + public static int BOULDER_ARROW_COLOUR; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + reset(); + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + World world = mc.theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.boulderToggled && Utils.inDungeons && world != null && player != null) { + // multi thread block checking + new Thread(() -> { + prevInBoulderRoom = inBoulderRoom; + int quartzBlocksFound = 0; + int barriersFound = 0; + BlockPos plusPlusQuartz = null; + BlockPos minusMinusQuartz = null; + Iterable blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 25, 68, player.posZ - 25), new BlockPos(player.posX + 25, 68, player.posZ + 25)); + // Detect boulder room + for (BlockPos blockPos : blocks) { + if (world.getBlockState(blockPos).getBlock() == Blocks.quartz_block) { + quartzBlocksFound++; + if (plusPlusQuartz == null || (blockPos.getX() >= plusPlusQuartz.getX() && blockPos.getZ() >= plusPlusQuartz.getZ())) { + plusPlusQuartz = blockPos; + } + if (minusMinusQuartz == null || (blockPos.getX() <= minusMinusQuartz.getX() && blockPos.getZ() <= minusMinusQuartz.getZ())) { + minusMinusQuartz = blockPos; + } + if (quartzBlocksFound == 8) { + break; + } + } else if (world.getBlockState(blockPos).getBlock() == Blocks.barrier) { + barriersFound++; + } + } + + if (quartzBlocksFound == 8 && barriersFound >= 350) { + inBoulderRoom = true; + if (!prevInBoulderRoom) { + // Get boulder locations + char[][] board = new char[7][7]; + for (int x = plusPlusQuartz.getX() - 1, iterationX = 0; iterationX < 7; x -= 3, iterationX++) { + for (int z = plusPlusQuartz.getZ() - 1, iterationZ = 0; iterationZ < 7; z -= 3, iterationZ++) { + BlockPos boulderPos = new BlockPos(x, 66, z); + if (world.getBlockState(boulderPos).getBlock() == Blocks.planks) { + board[iterationX][iterationZ] = 'X'; + } + } + } + + // Detect rotation of room + BlockPos northChest = minusMinusQuartz.add(11, -2, -2); + BlockPos eastChest = plusPlusQuartz.add(2, -2, -11); + BlockPos southChest = plusPlusQuartz.add(-11, -2, 2); + BlockPos westChest = minusMinusQuartz.add(-2, -2, 11); + if (world.getBlockState(northChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "north"; + chest = northChest; + board = BoulderUtils.flipVertically(BoulderUtils.rotateClockwise(board)); + } else if (world.getBlockState(eastChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "east"; + chest = eastChest; + board = BoulderUtils.flipHorizontally(board); + } else if (world.getBlockState(southChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "south"; + chest = southChest; + board = BoulderUtils.flipHorizontally(BoulderUtils.rotateClockwise(board)); + } else if (world.getBlockState(westChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "west"; + chest = westChest; + board = BoulderUtils.flipVertically(board); + } else { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Could not determine orientation of boulder room.")); + return; + } + board = BoulderUtils.removeFirstRow(board); + if (BoulderUtils.hasOpenPath(board)) return; + + long startTime = System.currentTimeMillis(); + reset(); + int length = BoulderUtils.findSolution(board, 0, route); + long endTime = System.currentTimeMillis(); + System.out.println("Time elapsed: " + (endTime - startTime) + "ms, " + BoulderUtils.iterations + " iterations."); + if (length == 10) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "No solution to puzzle found, most likely puzzle failed.")); + } else { + System.out.println("Solved " + boulderRoomDirection + " facing boulder room in " + length + " steps. Path:"); + for (int[] block : route) { + System.out.println(Arrays.toString(block)); + } + } + } + } else { + chest = null; + boulderRoomDirection = null; + inBoulderRoom = false; + } + }).start(); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.boulderToggled && Utils.inDungeons && route.size() > 0 && currentStep < route.size() && chest != null) { + int[] currentBlockArray = route.get(currentStep); + AxisAlignedBB currentBoulder = BoulderUtils.getBoulder(currentBlockArray[0], currentBlockArray[1], chest, boulderRoomDirection); + if (currentBoulder == null) return; + Utils.drawFilled3DBox(currentBoulder, BOULDER_COLOUR, true, false, event.partialTicks); + char direction; + switch (currentBlockArray[2]) { + case 1: + direction = 'u'; + break; + case 2: + direction = 'd'; + break; + case 3: + direction = 'l'; + break; + case 4: + direction = 'r'; + break; + default: + return; + } + BoulderUtils.drawArrow(currentBoulder, boulderRoomDirection, direction, 0xFF000000 + BOULDER_ARROW_COLOUR, event.partialTicks); + } + } + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (Minecraft.getMinecraft().thePlayer != event.entityPlayer || !inBoulderRoom || !ToggleCommand.boulderToggled) return; + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + if (block == Blocks.stone_button) currentStep++; + } + } + + static void reset() { + route.clear(); + currentStep = 0; + BoulderUtils.seenBoardStates.clear(); + BoulderUtils.iterations = 0; + BoulderUtils.fastestSolution = 10; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java index 8c7132c..7ff7e7a 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java @@ -78,7 +78,7 @@ public class CreeperSolver { public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { for (int i = 0; i < creeperLines.size(); i++) { - Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], event.partialTicks); + Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], 2, true, event.partialTicks); } } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java index 36721c1..8f7de95 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java @@ -68,7 +68,7 @@ public class ThreeManSolver { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.threeManToggled && riddleChest != null) { - Utils.drawFilled3DBox(new AxisAlignedBB(riddleChest.getX() - 0.05, riddleChest.getY(), riddleChest.getZ() - 0.05, riddleChest.getX() + 1.05, riddleChest.getY() + 1, riddleChest.getZ() + 1.05), 0x197F19, true, event.partialTicks); + Utils.drawFilled3DBox(new AxisAlignedBB(riddleChest.getX() - 0.05, riddleChest.getY(), riddleChest.getZ() - 0.05, riddleChest.getX() + 1.05, riddleChest.getY() + 1, riddleChest.getZ() + 1.05), 0x197F19, true, true, event.partialTicks); } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index ac2cd0c..b769634 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -6,8 +6,6 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -20,8 +18,7 @@ public class TriviaSolver { static String[] triviaAnswers = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; - @Mod.EventHandler - public void init(FMLInitializationEvent event) { + public static void init() { triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 4e5831d..ceda556 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -1,7 +1,6 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; -import me.Danker.commands.DisplayCommand; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 17eb433..f502df9 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -22,6 +22,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton creeper; private GuiButton water; private GuiButton ticTacToe; + private GuiButton boulder; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -56,12 +57,13 @@ public class PuzzleSolversGui extends GuiScreen { creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled)); water = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled)); ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); - startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + boulder = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled)); // Page 2 - selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); - clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); - blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -71,10 +73,11 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(creeper); this.buttonList.add(water); this.buttonList.add(ticTacToe); - this.buttonList.add(startsWith); + this.buttonList.add(boulder); this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); this.buttonList.add(blockClicks); @@ -123,6 +126,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.ticTacToeToggled = !ToggleCommand.ticTacToeToggled; ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ToggleCommand.ticTacToeToggled); ticTacToe.displayString = "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled); + } else if (button == boulder) { + ToggleCommand.boulderToggled = !ToggleCommand.boulderToggled; + ConfigHandler.writeBooleanConfig("toggles", "BoulderPuzzle", ToggleCommand.boulderToggled); + boulder.displayString = "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled); } else if (button == startsWith) { ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", ToggleCommand.startsWithToggled); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 53f499b..30778e7 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 me.Danker.DankersSkyblockMod; -import me.Danker.commands.DisplayCommand; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; @@ -252,6 +251,7 @@ public class ConfigHandler { ToggleCommand.creeperToggled = initBoolean("toggles", "CreeperPuzzle", false); ToggleCommand.waterToggled = initBoolean("toggles", "WaterPuzzle", false); ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); + ToggleCommand.boulderToggled = initBoolean("toggles", "BoulderPuzzle", false); ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); @@ -508,6 +508,8 @@ public class ConfigHandler { ChronomatronSolver.CHRONOMATRON_NEXT_TO_NEXT = initInt("colors", "chronomatronNextToNext", 0x40DAE6); ClickInOrderSolver.CLICK_IN_ORDER_NEXT = initInt("colors", "clickInOrderNext", 0xFF00DD); ClickInOrderSolver.CLICK_IN_ORDER_NEXT_TO_NEXT = initInt("colors", "clickInOrderNextToNext", 0x0BEFE7); + BoulderSolver.BOULDER_COLOUR = initInt("colors", "boulder", 0x197F19); + BoulderSolver.BOULDER_ARROW_COLOUR = initInt("colors", "boulderArrow", 0x006000); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); diff --git a/src/main/java/me/Danker/utils/BoulderUtils.java b/src/main/java/me/Danker/utils/BoulderUtils.java new file mode 100644 index 0000000..2d437d0 --- /dev/null +++ b/src/main/java/me/Danker/utils/BoulderUtils.java @@ -0,0 +1,280 @@ +package me.Danker.utils; + +import me.Danker.features.puzzlesolvers.BoulderSolver; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +public class BoulderUtils { + + public static HashSet seenBoardStates = new HashSet<>(); + public static long iterations = 0; + public static int fastestSolution = 10; + + /* + CC BY-SA 4.0 + Unmodified + Question: https://stackoverflow.com/questions/5617016/ + Answer: https://stackoverflow.com/a/53397359 + Author: https://stackoverflow.com/users/3647002/gayan-weerakutti + */ + public static char[][] copy(char[][] array) { + return Arrays.stream(array).map(char[]::clone).toArray(char[][]::new); + } + + public static char[][] flipVertically(char[][] board) { + char[][] newBoard = new char[7][7]; + + for (int row = 0; row < 7; row++) { + System.arraycopy(board[6 - row], 0, newBoard[row], 0, 7); + } + + return newBoard; + } + + public static char[][] flipHorizontally(char[][] board) { + char[][] newBoard = new char[7][7]; + + for (int row = 0; row < 7; row++) { + for (int column = 0; column < 7; column++) { + newBoard[row][column] = board[row][6 - column]; + } + } + + return newBoard; + } + + public static char[][] rotateClockwise(char[][] board) { + char[][] newBoard = new char[7][7]; + + for (int row = 0; row < 7; row++) { + for (int column = 0; column < 7; column++) { + newBoard[column][6 - row] = board[row][column]; + } + } + + return newBoard; + } + + public static char[][] removeFirstRow(char[][] board) { + List list = new ArrayList<>(Arrays.asList(board)); + list.remove(0); + return list.toArray(new char[][]{}); + } + + public static String toString(char[][] board) { + StringBuilder sb = new StringBuilder(); + for (char[] row : board) { + for (char column : row) { + sb.append(column); + } + } + return sb.toString(); + } + + public static int findSolution(char[][] board, int depth, List route) { + if (depth > 9) return 10; + String boardString = toString(board); + if (seenBoardStates.contains(boardString)) return 10; // this line turns 600 million iterations to 700 thousand + seenBoardStates.add(boardString); + if (hasOpenPath(board)) return depth; + + char[][] floodFilledBoard = floodFillBottom(board); + List newRoute = new ArrayList<>(route); + int solutionLength = 10; + int bestRow = -1; + int bestColumn = -1; + int bestDirection = -1; + for (int row = 0; row < 6; row++) { + for (int column = 0; column < 7; column++) { + iterations++; + if (floodFilledBoard[row][column] == 'X' && isTouchingOpenSpace(floodFilledBoard, row, column)) { + if (canBePushed(floodFilledBoard, row, column, 'u')) { + int solution = findSolution(push(board, row, column, 'u'), depth + 1, add(newRoute, new int[]{row, column, 1})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 1; + } + } + if (canBePushed(floodFilledBoard, row, column, 'd')) { + int solution = findSolution(push(board, row, column, 'd'), depth + 1, add(newRoute, new int[]{row, column, 2})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 2; + } + } + if (canBePushed(floodFilledBoard, row, column, 'l')) { + int solution = findSolution(push(board, row, column, 'l'), depth + 1, add(newRoute, new int[]{row, column, 3})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 3; + } + } + if (canBePushed(floodFilledBoard, row, column, 'r')) { + int solution = findSolution(push(board, row, column, 'r'), depth + 1, add(newRoute, new int[]{row, column, 4})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 4; + } + } + } + } + } + + if (bestRow != -1) { + newRoute.add(0, new int[]{bestRow, bestColumn, bestDirection}); + } + if (solutionLength < fastestSolution) { + fastestSolution = solutionLength; + newRoute.add(newRoute.remove(0)); // dont know why the last one goes first but this fixes it + BoulderSolver.route = new ArrayList<>(newRoute); + } + return solutionLength; + } + + public static boolean canBePushed(char[][] floodFilledBoard, int row, int column, char direction) { + switch (direction) { + case 'u': + if (row > 0 && row < 5 && floodFilledBoard[row - 1][column] != 'X' && floodFilledBoard[row + 1][column] == 'O') return true; + break; + case 'd': + if (row > 0 && row < 5 && floodFilledBoard[row - 1][column] == 'O' && floodFilledBoard[row + 1][column] != 'X') return true; + break; + case 'l': + if (column > 0 && column < 6 && floodFilledBoard[row][column - 1] != 'X' && floodFilledBoard[row][column + 1] == 'O') return true; + break; + case 'r': + if (column > 0 && column < 6 && floodFilledBoard[row][column - 1] == 'O' && floodFilledBoard[row][column + 1] != 'X') return true; + break; + } + return false; + } + + public static char[][] push(char[][] board, int row, int column, char direction) { + char[][] newBoard = copy(board); + switch (direction) { + case 'u': + newBoard[row - 1][column] = 'X'; + break; + case 'd': + newBoard[row + 1][column] = 'X'; + break; + case 'l': + newBoard[row][column - 1] = 'X'; + break; + case 'r': + newBoard[row][column + 1] = 'X'; + } + newBoard[row][column] = '\0'; + return newBoard; + } + + public static boolean isTouchingOpenSpace(char[][] floodFilledBoard, int row, int column) { + return (row > 0 && floodFilledBoard[row - 1][column] == 'O') || + (row < 5 && floodFilledBoard[row + 1][column] == 'O') || + (column > 0 && floodFilledBoard[row][column - 1] == 'O') || + (column < 6 && floodFilledBoard[row][column + 1] == 'O'); + } + + public static boolean hasOpenPath(char[][] board) { + char[][] newBoard = floodFillBottom(copy(board)); + // Check if flood fill reached top + for (int column = 0; column < 7; column++) { + if (newBoard[0][column] == 'O') return true; + } + return false; + } + + public static char[][] floodFillBottom(char[][] board) { + char[][] newBoard = copy(board); + for (int column = 0; column < 7; column++) { + if (newBoard[5][column] == '\0') { + newBoard = floodFill(newBoard, 5, column); + } + } + return newBoard; + } + + public static char[][] floodFill(char[][] board, int row, int column) { + if (row < 0 || row > 5 || column < 0 || column > 6) return board; + if (board[row][column] == '\0') { + board[row][column] = 'O'; + floodFill(board, row - 1, column); + floodFill(board, row + 1, column); + floodFill(board, row, column - 1); + floodFill(board, row, column + 1); + return board; + } + return board; + } + + public static List add(List list, int[] arrayToAdd) { + List newList = new ArrayList<>(list); + newList.add(arrayToAdd); + return newList; + } + + public static AxisAlignedBB getBoulder(int row, int column, BlockPos chestLocation, String boulderRoomDirection) { + BlockPos boulderPosition; + switch (boulderRoomDirection) { + case "north": + boulderPosition = chestLocation.add(3 * column - 10, -2, 3 * row + 4); + break; + case "east": + boulderPosition = chestLocation.add(-3 * row - 6, -2, 3 * column - 10); + break; + case "south": + boulderPosition = chestLocation.add(-3 * column + 8, -2, -3 * row - 6); + break; + case "west": + boulderPosition = chestLocation.add(3 * row + 4, -2, -3 * column + 8); + break; + default: + return null; + } + return new AxisAlignedBB(boulderPosition.getX() - 0.01, boulderPosition.getY() - 0.01, boulderPosition.getZ() - 0.01, boulderPosition.getX() + 3.01, boulderPosition.getY() + 3.01, boulderPosition.getZ() + 3.01); + } + + public static void drawArrow(AxisAlignedBB aabb, String boulderRoomDirection, char direction, int colourInt, float partialTicks) { + double averageX = (aabb.minX + aabb.maxX) / 2; + double thirtyPercent = (aabb.maxX - aabb.minX) * 0.3; + double averageZ = (aabb.minZ + aabb.maxZ) / 2; + if (((boulderRoomDirection.equals("north") || boulderRoomDirection.equals("south")) && (direction == 'u' || direction == 'd')) || + ((boulderRoomDirection.equals("east") || boulderRoomDirection.equals("west")) && (direction == 'l' || direction == 'r'))) { + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.minZ), new Vec3(averageX, aabb.minY, aabb.maxZ), colourInt, 10, false, partialTicks); + } else { + Utils.draw3DLine(new Vec3(aabb.minX, aabb.minY, averageZ), new Vec3(aabb.maxX, aabb.minY, averageZ), colourInt, 10, false, partialTicks); + } + + if ((boulderRoomDirection.equals("north") && direction == 'u') || (boulderRoomDirection.equals("south") && direction == 'd') || + (boulderRoomDirection.equals("east") && direction == 'l') || (boulderRoomDirection.equals("west") && direction == 'r')) { + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.minZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.minZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + } else if ((boulderRoomDirection.equals("north") && direction == 'd') || (boulderRoomDirection.equals("south") && direction == 'u') || + (boulderRoomDirection.equals("east") && direction == 'r') || (boulderRoomDirection.equals("west") && direction == 'l')) { + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.maxZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.maxZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + } else if ((boulderRoomDirection.equals("north") && direction == 'l') || (boulderRoomDirection.equals("south") && direction == 'r') || + (boulderRoomDirection.equals("east") && direction == 'd') || (boulderRoomDirection.equals("west") && direction == 'u')) { + Utils.draw3DLine(new Vec3(aabb.minX, aabb.minY, averageZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(aabb.minX, aabb.minY, averageZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + } else { + Utils.draw3DLine(new Vec3(aabb.maxX, aabb.minY, averageZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(aabb.maxX, aabb.minY, averageZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + } + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 911704f..1a24c69 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -305,7 +305,7 @@ public class Utils { }); } - public static void draw3DLine(Vec3 pos1, Vec3 pos2, int colourInt, float partialTicks) { + public static void draw3DLine(Vec3 pos1, Vec3 pos2, int colourInt, int lineWidth, boolean depth, float partialTicks) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); Color colour = new Color(colourInt); @@ -320,7 +320,11 @@ public class Utils { GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GL11.glLineWidth(2); + GL11.glLineWidth(lineWidth); + if (!depth) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(false); + } GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); @@ -329,6 +333,10 @@ public class Utils { Tessellator.getInstance().draw(); GlStateManager.translate(realX, realY, realZ); + if (!depth) { + GL11.glEnable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(true); + } GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); @@ -386,7 +394,7 @@ public class Utils { GlStateManager.popMatrix(); } - public static void drawFilled3DBox(AxisAlignedBB aabb, int colourInt, boolean translucent, float partialTicks) { + public static void drawFilled3DBox(AxisAlignedBB aabb, int colourInt, boolean translucent, boolean depth, float partialTicks) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); Color colour = new Color(colourInt); @@ -401,8 +409,12 @@ public class Utils { GlStateManager.disableTexture2D(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, translucent ? 1 : 771, 1, 0); GlStateManager.disableCull(); + GlStateManager.tryBlendFuncSeparate(770, translucent ? 1 : 771, 1, 0); + if (!depth) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(false); + } GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); // Bottom @@ -438,6 +450,10 @@ public class Utils { Tessellator.getInstance().draw(); GlStateManager.translate(realX, realY, realZ); + if (!depth) { + GL11.glEnable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(true); + } GlStateManager.enableCull(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); -- cgit