From 4f478737d5777c4e6780ab1a8aa7162368b21cb0 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 27 Feb 2021 20:26:51 -0500 Subject: Change outlined box rendering --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 05c5f1b..e96ce00 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,5 @@ Credit to all the following open source software used in this mod. Software | License ------------ | ------------- [SkyblockAddons](https://github.com/BiscuitDevelopment/SkyblockAddons/) | [MIT License](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/master/LICENSE) -[Zealot Counter](https://github.com/symt/zealot-counter/) | No License +[Zealot Counter](https://github.com/symt/zealot-counter/) | [Apache License](https://github.com/symt/zealot-counter/blob/master/LICENSE.md) [NotEnoughUpdates](https://github.com/Moulberry/NotEnoughUpdates/) | [Creative Commons Public License](https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE) -[ForgeHax](https://github.com/fr1kin/ForgeHax) | [MIT License](https://github.com/fr1kin/ForgeHax/blob/1.16/LICENSE) \ No newline at end of file -- 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 'README.md') 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 From ec35b6f8d7583f9c92eb212bfe4cf8d2206fc403 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 9 Mar 2021 23:55:43 -0500 Subject: Add silverfish puzzle solver --- README.md | 4 +- build.gradle | 2 +- src/main/java/me/Danker/DankersSkyblockMod.java | 3 +- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 + .../java/me/Danker/commands/ToggleCommand.java | 26 ++- .../features/puzzlesolvers/SilverfishSolver.java | 183 +++++++++++++++++++++ src/main/java/me/Danker/gui/PuzzleSolversGui.java | 17 +- .../java/me/Danker/handlers/ConfigHandler.java | 4 +- src/main/java/me/Danker/utils/SilverfishUtils.java | 104 ++++++++++++ 10 files changed, 327 insertions(+), 19 deletions(-) create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java create mode 100644 src/main/java/me/Danker/utils/SilverfishUtils.java (limited to 'README.md') diff --git a/README.md b/README.md index 6673b43..b1bf536 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Discord Server: https://discord.gg/QsEkNQS - 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, boulder) +- Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe, boulder, silverfish) - 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) @@ -53,7 +53,7 @@ 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/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. diff --git a/build.gradle b/build.gradle index ee8e79b..7fd2d15 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.8.6-beta1" +version = "1.8.6-beta2" group= "me.Danker.DankersSkyblockMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 0920520..dbb79dc 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -59,7 +59,7 @@ import java.util.Map; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.6-beta1"; + public static final String VERSION = "1.8.6-beta2"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; @@ -114,6 +114,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new PetColours()); MinecraftForge.EVENT_BUS.register(new Reparty()); MinecraftForge.EVENT_BUS.register(new SelectAllColourSolver()); + MinecraftForge.EVENT_BUS.register(new SilverfishSolver()); MinecraftForge.EVENT_BUS.register(new Skill50Display()); MinecraftForge.EVENT_BUS.register(new SkillTracker()); MinecraftForge.EVENT_BUS.register(new SpamHider()); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 6272a60..71e2414 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" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 9ba86da..dddc662 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -73,6 +73,7 @@ public class DankerGuiCommand extends CommandBase { 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("[silverfishpuzzle][").append(ToggleCommand.silverfishToggled).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"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 77dc82e..a69457f 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -56,6 +56,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean waterToggled; public static boolean ticTacToeToggled; public static boolean boulderToggled; + public static boolean silverfishToggled; // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; @@ -81,9 +82,9 @@ public class ToggleCommand extends CommandBase implements ICommand { "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>"; + "tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/startswithterminal/" + + "selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/" + + "ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -98,12 +99,15 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", - "implosionmessages", "healmessages", "cooldownmessages", "manamessages", "caketimer", "lowhealthnotify", "autoskilltracker", - "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", + "implosionmessages", "healmessages", "cooldownmessages", "manamessages", + "caketimer", "lowhealthnotify", "autoskilltracker", "lividsolver", + "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle", - "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", - "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", - "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); + "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "boulderpuzzle", + "silverfishpuzzle", "watchermessage", "startswithterminal", + "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", + "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", + "hidetooltipsinaddons", "pickblock", "list"); } return null; } @@ -309,6 +313,11 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 "silverfishpuzzle": + silverfishToggled = !silverfishToggled; + ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", silverfishToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Silverfish puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + silverfishToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "watchermessage": watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); @@ -399,6 +408,7 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 + " Silverfish puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + silverfishToggled + "\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/puzzlesolvers/SilverfishSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java new file mode 100644 index 0000000..c07524d --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java @@ -0,0 +1,183 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.SilverfishUtils; +import me.Danker.utils.Utils; +import net.minecraft.block.BlockHopper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.*; +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.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class SilverfishSolver { + + static boolean prevInSilverfishRoom = false; + static boolean inSilverfishRoom = false; + static BlockPos chest = null; + static EnumFacing silverfishRoomDirection = null; + static List route = new ArrayList<>(); + public static int SILVERFISH_LINE_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(); + World world = mc.theWorld; + EntityPlayerSP player = mc.thePlayer; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.silverfishToggled && Utils.inDungeons && world != null && player != null) { + new Thread(() -> { + boolean foundRoom = false; + prevInSilverfishRoom = inSilverfishRoom; + double x = player.posX; + double z = player.posZ; + // Find creepers nearby + AxisAlignedBB entityScan = new AxisAlignedBB(x - 25, 67, z - 25, x + 25, 68, z + 25); // 50x1x50 + List silverfishes = world.getEntitiesWithinAABB(EntitySilverfish.class, entityScan); + List items = world.getEntitiesWithinAABB(EntityItem.class, entityScan); + if (silverfishes.size() > 0 && items.size() > 0) { + double silverfishX = silverfishes.get(0).posX; + double silverfishZ = silverfishes.get(0).posZ; + for (EntityItem item : items) { + if (Item.getIdFromItem(item.getEntityItem().getItem()) == 46 && Math.abs(item.posX - silverfishX) < 1 && Math.abs(item.posZ - silverfishZ) < 1) { + Iterable blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 27, 67, player.posZ - 27), new BlockPos(player.posX + 27, 67, player.posZ + 27)); + for (BlockPos blockPos : blocks) { + if (world.getBlockState(blockPos).getBlock() == Blocks.chest && world.getBlockState(blockPos.add(0, 2, 0)).getBlock() == Blocks.hopper) { + foundRoom = true; + inSilverfishRoom = true; + if (!prevInSilverfishRoom) { + chest = blockPos; + BlockPos silverfishBlock = new BlockPos(silverfishX, 67, silverfishZ); + TileEntity hopper = world.getTileEntity(blockPos.add(0, 2, 0)); + silverfishRoomDirection = BlockHopper.getFacing(hopper.getBlockMetadata()); + char[][] board = new char[19][19]; + SilverfishUtils.Point silverfishPoint = null; + + switch (silverfishRoomDirection) { + case NORTH: + for (int row = chest.getZ() + 3, xIteration = 0; xIteration < 19; row++, xIteration++) { + for (int column = chest.getX() - 9, yIteration = 0; yIteration < 19; column++, yIteration++) { + if (world.getBlockState(new BlockPos(column, 67, row)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(column, 67, row))) { + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + case EAST: + for (int row = chest.getX() - 3, xIteration = 0; xIteration < 19; row--, xIteration++) { + for (int column = chest.getZ() - 9, yIteration = 0; yIteration < 19; column++, yIteration++) { + if (world.getBlockState(new BlockPos(row, 67, column)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(row, 67, column))) { + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + case SOUTH: + for (int row = chest.getZ() - 3, xIteration = 0; xIteration < 19; row--, xIteration++) { + for (int column = chest.getX() + 9, yIteration = 0; yIteration < 19; column--, yIteration++) { + if (world.getBlockState(new BlockPos(column, 67, row)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(column, 67, row))) { + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + case WEST: + for (int row = chest.getX() + 3, xIteration = 0; xIteration < 19; row++, xIteration++) { + for (int column = chest.getZ() + 9, yIteration = 0; yIteration < 19; column--, yIteration++) { + if (world.getBlockState(new BlockPos(row, 67, column)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(row, 67, column))) { + board[xIteration][yIteration] = 'S'; + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + default: + return; + } + System.out.println(Arrays.deepToString(board)); + + List endPoints = new ArrayList<>(); + for (int column = 0; column < 19; column++) { + if (board[0][column] != 'X') endPoints.add(new SilverfishUtils.Point(0, column)); + } + + route = SilverfishUtils.solve(board, silverfishPoint, endPoints); + } + } + } + } + } + } + if (!foundRoom) reset(); + }).start(); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.silverfishToggled && Utils.inDungeons && route != null && route.size() > 0 && chest != null) { + for (int i = 0; i < route.size() - 1; i++) { + Vec3 pos1 = null; + Vec3 pos2 = null; + switch (silverfishRoomDirection) { + case NORTH: + pos1 = new Vec3(chest.getX() - 8.5 + route.get(i).column, 67.5, chest.getZ() + 3.5 + route.get(i).row); + pos2 = new Vec3(chest.getX() - 8.5 + route.get(i + 1).column, 67.5, chest.getZ() + 3.5 + route.get(i + 1).row); + break; + case EAST: + pos1 = new Vec3(chest.getX() - 2.5 - route.get(i).row, 67.5, chest.getZ() - 8.5 + route.get(i).column); + pos2 = new Vec3(chest.getX() - 2.5 - route.get(i + 1).row, 67.5, chest.getZ() - 8.5 + route.get(i + 1).column); + break; + case SOUTH: + pos1 = new Vec3(chest.getX() + 9.5 - route.get(i).column, 67.5, chest.getZ() - 2.5 - route.get(i).row); + pos2 = new Vec3(chest.getX() + 9.5 - route.get(i + 1).column, 67.5, chest.getZ() - 2.5 - route.get(i + 1).row); + break; + case WEST: + pos1 = new Vec3(chest.getX() + 3.5 + route.get(i).row, 67.5, chest.getZ() + 9.5 - route.get(i).column); + pos2 = new Vec3(chest.getX() + 3.5 + route.get(i + 1).row, 67.5, chest.getZ() + 9.5 - route.get(i + 1).column); + break; + default: + return; + } + Utils.draw3DLine(pos1, pos2, SILVERFISH_LINE_COLOUR, 5, true, event.partialTicks); + } + } + } + + static void reset() { + inSilverfishRoom = false; + chest = null; + silverfishRoomDirection = null; + route.clear(); + } + +} diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index f502df9..3864b80 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -23,6 +23,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton water; private GuiButton ticTacToe; private GuiButton boulder; + private GuiButton silverfish; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -59,11 +60,12 @@ public class PuzzleSolversGui extends GuiScreen { ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); boulder = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled)); // Page 2 - 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)); + silverfish = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -77,6 +79,7 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(silverfish); this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); @@ -130,6 +133,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.boulderToggled = !ToggleCommand.boulderToggled; ConfigHandler.writeBooleanConfig("toggles", "BoulderPuzzle", ToggleCommand.boulderToggled); boulder.displayString = "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled); + } else if (button == silverfish) { + ToggleCommand.silverfishToggled = !ToggleCommand.silverfishToggled; + ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", ToggleCommand.silverfishToggled); + silverfish.displayString = "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled); } 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 30778e7..96c0e75 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -90,7 +90,7 @@ public class ConfigHandler { } return true; } - + public static void writeIntConfig(String category, String key, int value) { config = new Configuration(new File(file)); try { @@ -252,6 +252,7 @@ public class ConfigHandler { ToggleCommand.waterToggled = initBoolean("toggles", "WaterPuzzle", false); ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); ToggleCommand.boulderToggled = initBoolean("toggles", "BoulderPuzzle", false); + ToggleCommand.silverfishToggled = initBoolean("toggles", "SilverfishPuzzle", false); ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); @@ -510,6 +511,7 @@ public class ConfigHandler { 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); + SilverfishSolver.SILVERFISH_LINE_COLOUR = initInt("colors", "silverfishLine", 0x40FF40); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); diff --git a/src/main/java/me/Danker/utils/SilverfishUtils.java b/src/main/java/me/Danker/utils/SilverfishUtils.java new file mode 100644 index 0000000..e495da5 --- /dev/null +++ b/src/main/java/me/Danker/utils/SilverfishUtils.java @@ -0,0 +1,104 @@ +package me.Danker.utils; + +import java.util.*; + +public class SilverfishUtils { + + // bfs + public static List solve(char[][] board, Point startPos, List endColumns) { + LinkedList queue = new LinkedList<>(); + Map visited = new HashMap<>(); + queue.add(startPos); + visited.put(startPos, null); + while (!queue.isEmpty()) { + if (queue.size() > 1000000) break; + Point position = queue.pollFirst(); + for (Direction direction : Direction.values()) { + Point pushedPoint = push(board, position, direction); + if (visited.containsKey(pushedPoint)) continue; + queue.add(pushedPoint); + visited.put(pushedPoint, position); + for (Point endColumn : endColumns) { + if (pushedPoint.equals(endColumn)) { + List route = new ArrayList<>(); + Point lastPoint = pushedPoint; + while (lastPoint != null) { + route.add(0, lastPoint); + lastPoint = visited.get(lastPoint); + } + return route; + } + } + } + } + return new ArrayList<>(); + } + + public static Point push(char[][] board, Point pos, Direction direction) { + switch (direction) { + case UP: + for (int row = pos.row; row >= 0; row--) { + if (board[row][pos.column] == 'X') { + return new Point(row + 1, pos.column); + } + } + return new Point(0, pos.column); + case DOWN: + for (int row = pos.row; row <= 18; row++) { + if (board[row][pos.column] == 'X') { + return new Point(row - 1, pos.column); + } + } + return new Point(18, pos.column); + case LEFT: + for (int column = pos.column; column >= 0; column--) { + if (board[pos.row][column] == 'X') { + return new Point(pos.row, column + 1); + } + } + return new Point(pos.row, 0); + case RIGHT: + for (int column = pos.column; column <= 18; column++) { + if (board[pos.row][column] == 'X') { + return new Point(pos.row, column - 1); + } + } + return new Point(pos.row, 18); + } + return null; + } + + public static class Point { + + public int row; + public int column; + + public Point(int row, int column) { + this.row = row; + this.column = column; + } + + @Override + public int hashCode() { + return Objects.hash(row, column); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Point) { + Point point = (Point) obj; + return row == point.row && column == point.column; + } + return false; + } + + } + + enum Direction { + UP, + DOWN, + LEFT, + RIGHT + } + +} -- cgit From 5a86451ed34e7d5c9baf20a4c9f4678ecc55fae1 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 10 Mar 2021 09:54:23 -0500 Subject: Hide kill combo messages --- README.md | 3 +- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 3 ++ .../java/me/Danker/commands/ToggleCommand.java | 19 ++++++--- src/main/java/me/Danker/features/SpamHider.java | 7 ++++ src/main/java/me/Danker/gui/DankerGui.java | 47 +++++++++++++--------- .../java/me/Danker/handlers/ConfigHandler.java | 3 +- 7 files changed, 55 insertions(+), 29 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index b1bf536..026d08d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Discord Server: https://discord.gg/QsEkNQS - Disable heal messages - Disable ability cooldown messages - Disable out of mana messages +- Disable kill combo messages - Slayer item tracker - RNGesus drop alerts - Click anywhere on-screen to open Maddox @@ -53,7 +54,7 @@ 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/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 71e2414..c1ae5af 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" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index dddc662..fff1ce7 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -58,6 +58,9 @@ public class DankerGuiCommand extends CommandBase { debug.append("[midasstaffmessages][").append(ToggleCommand.midasStaffMessages).append("]\n"); debug.append("[implosionmessages][").append(ToggleCommand.implosionMessages).append("]\n"); debug.append("[healmessages][").append(ToggleCommand.healMessages).append("]\n"); + debug.append("[cooldownmessages][").append(ToggleCommand.cooldownMessages).append("]\n"); + debug.append("[manamessages][").append(ToggleCommand.manaMessages).append("]\n"); + debug.append("[killcombomessages][").append(ToggleCommand.killComboMessages).append("]\n"); debug.append("[caketimer][").append(ToggleCommand.cakeTimerToggled).append("]\n"); debug.append("[lowhealthnotify][").append(ToggleCommand.lowHealthNotifyToggled).append("]\n"); debug.append("[lividsolver][").append(ToggleCommand.lividSolverToggled).append("]\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index a69457f..294cf1a 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -37,6 +37,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean healMessages; public static boolean cooldownMessages; public static boolean manaMessages; + public static boolean killComboMessages; // Dungeons Messages public static boolean lowHealthNotifyToggled; public static boolean lividSolverToggled; @@ -80,11 +81,11 @@ public class ToggleCommand extends CommandBase implements ICommand { return "/" + getCommandName() + " "; + "manamessages/killcombomessages/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/" + + "notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/" + + "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/" + + "startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" + + "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -100,7 +101,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "cooldownmessages", "manamessages", - "caketimer", "lowhealthnotify", "autoskilltracker", "lividsolver", + "killcombomessages", "caketimer", "lowhealthnotify", "autoskilltracker", "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "boulderpuzzle", @@ -207,6 +208,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "ManaMessages", manaMessages); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Out of mana messages has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + manaMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "killcombomessages": + killComboMessages = !killComboMessages; + ConfigHandler.writeBooleanConfig("toggles", "KillComboMessages", killComboMessages); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Kill combo messages has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + killComboMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "petcolors": case "petcolours": petColoursToggled = !petColoursToggled; @@ -391,6 +397,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Heal messages: " + DankersSkyblockMod.VALUE_COLOUR + healMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Ability cooldown messages: " + DankersSkyblockMod.VALUE_COLOUR + cooldownMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Out of mana messages: " + DankersSkyblockMod.VALUE_COLOUR + manaMessages + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Kill combo messages: " + DankersSkyblockMod.VALUE_COLOUR + killComboMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Pet colours: " + DankersSkyblockMod.VALUE_COLOUR + petColoursToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Dungeon timer: " + DankersSkyblockMod.VALUE_COLOUR + dungeonTimerToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Golem spawn alerts: " + DankersSkyblockMod.VALUE_COLOUR + golemAlertToggled + "\n" + diff --git a/src/main/java/me/Danker/features/SpamHider.java b/src/main/java/me/Danker/features/SpamHider.java index 4b22f61..a88d9e5 100644 --- a/src/main/java/me/Danker/features/SpamHider.java +++ b/src/main/java/me/Danker/features/SpamHider.java @@ -44,6 +44,13 @@ public class SpamHider { if (!ToggleCommand.implosionMessages) { if (message.contains("Your Implosion hit ") || message.contains("There are blocks in the way")) { event.setCanceled(true); + return; + } + } + // Kill Combo + if (!ToggleCommand.killComboMessages) { + if ((message.contains("+") && message.contains(" Kill Combo ")) || message.contains("Your Kill Combo has expired!")) { + event.setCanceled(true); } } } diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 90aa5e5..a6d2bb1 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -54,6 +54,7 @@ public class DankerGui extends GuiScreen { private GuiButton healMessages; private GuiButton cooldownMessages; private GuiButton manaMessages; + private GuiButton killComboMessages; //Dungeons private GuiButton dungeonTimer; private GuiButton lowHealthNotify; @@ -115,27 +116,28 @@ public class DankerGui extends GuiScreen { implosionMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Implosion Messages: " + Utils.getColouredBoolean(ToggleCommand.implosionMessages)); healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); cooldownMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Cooldown Messages: " + Utils.getColouredBoolean(ToggleCommand.cooldownMessages)); - manaMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Mana Messages: " + Utils.getColouredBoolean((ToggleCommand.manaMessages))); + manaMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Mana Messages: " + Utils.getColouredBoolean(ToggleCommand.manaMessages)); // Page 4 - goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); - splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); + killComboMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); // Page 5 - lowHealthNotify = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); - lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); - dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); - stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); - watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); - flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); - notifySlayerSlain = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); + splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); + lowHealthNotify = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); + lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); + watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); + flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); //Page 6 - necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); - bonzoTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); - autoSkillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); + notifySlayerSlain = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); + necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); + bonzoTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); + autoSkillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); switch (page) { case 1: @@ -171,28 +173,29 @@ public class DankerGui extends GuiScreen { this.buttonList.add(backPage); break; case 4: + this.buttonList.add(killComboMessages); this.buttonList.add(goldenEnch); this.buttonList.add(petColours); this.buttonList.add(expertiseLore); this.buttonList.add(gparty); this.buttonList.add(golemAlerts); this.buttonList.add(rngesusAlert); - this.buttonList.add(splitFishing); this.buttonList.add(nextPage); this.buttonList.add(backPage); break; case 5: + this.buttonList.add(splitFishing); this.buttonList.add(lowHealthNotify); this.buttonList.add(lividSolver); this.buttonList.add(dungeonTimer); this.buttonList.add(stopSalvageStarred); this.buttonList.add(watcherReadyMessage); this.buttonList.add(flowerWeapons); - this.buttonList.add(notifySlayerSlain); this.buttonList.add(nextPage); this.buttonList.add(backPage); break; case 6: + this.buttonList.add(notifySlayerSlain); this.buttonList.add(necronNotifications); this.buttonList.add(bonzoTimer); this.buttonList.add(autoSkillTracker); @@ -379,6 +382,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.autoSkillTrackerToggled = !ToggleCommand.autoSkillTrackerToggled; ConfigHandler.writeBooleanConfig("toggles", "AutoSkillTracker", ToggleCommand.autoSkillTrackerToggled); autoSkillTracker.displayString = "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled); + } else if (button == killComboMessages) { + ToggleCommand.killComboMessages = !ToggleCommand.killComboMessages; + ConfigHandler.writeBooleanConfig("toggles", "KillComboMessages", ToggleCommand.killComboMessages); + killComboMessages.displayString = "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 96c0e75..52b1883 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -232,7 +232,8 @@ public class ConfigHandler { ToggleCommand.healMessages = initBoolean("toggles", "HealMessages", true); ToggleCommand.cooldownMessages = initBoolean("toggles", "CooldownMessages", true); ToggleCommand.manaMessages = initBoolean("toggles", "ManaMessages", true); - //Dungeons + ToggleCommand.killComboMessages = initBoolean("toggles", "KillComboMessages", true); + // Dungeons ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "DungeonTimer", false); ToggleCommand.lowHealthNotifyToggled = initBoolean("toggles", "LowHealthNotify", false); ToggleCommand.lividSolverToggled = initBoolean("toggles", "LividSolver", false); -- cgit From 3fd8f7d8c0973fb69e921b090211206ddd4dd19f Mon Sep 17 00:00:00 2001 From: CuzImClicks Date: Wed, 10 Mar 2021 21:11:00 +0100 Subject: added features to dhelp, dankerguicommand and readme --- README.md | 4 ++++ src/main/java/me/Danker/commands/DHelpCommand.java | 1 + src/main/java/me/Danker/commands/DankerGuiCommand.java | 3 +++ 3 files changed, 8 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 026d08d..5005273 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Discord Server: https://discord.gg/QsEkNQS - Golden T10/T6/T4 enchant display - Block AOTD ability - Block Livid Dagger ability +- Block Shadow Fury ability +- Block right click with special hoes - Block placing Flower of Truth/Spirit Sceptre - Disable Spirit Sceptre messages - Disable Midas Staff messages @@ -40,6 +42,7 @@ Discord Server: https://discord.gg/QsEkNQS - Find correct Livid (with graphic display of HP) - Experimentation solvers (Ultrasequencer, Chronomatron, Superpairs) - Hide tooltips in experiment addons +- Hide tooltips in Melody's Harp - Pet background colors based on level - Golem spawning alerts - Skill xp/hour tracker @@ -75,6 +78,7 @@ Discord Server: https://discord.gg/QsEkNQS - /onlyslayer <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. - /skilltracker - Text display for skill xp/hour. - /reparty - Disbands and reparties all members in the party +- /fairysouls - Check the fairysouls of a player ## Keybinds - Open Maddox menu - M by default. diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index c1ae5af..844bb91 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -55,6 +55,7 @@ public class DHelpCommand extends CommandBase { 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.GOLD + " /lobbybank " + EnumChatFormatting.AQUA + " - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank(and purse).\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 fff1ce7..fdd8196 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -88,6 +88,9 @@ public class DankerGuiCommand extends CommandBase { debug.append("[superpairs][").append(ToggleCommand.superpairsToggled).append("]\n"); debug.append("[hidetooltipsinaddons][").append(ToggleCommand.hideTooltipsInExperimentAddonsToggled).append("]\n"); debug.append("[pickblock][").append(ToggleCommand.swapToPickBlockToggled).append("]\n"); + debug.append("[shadowFuryAbility][").append(ToggleCommand.shadowFuryToggled).append("]\n"); + debug.append("[specialhoe][").append(ToggleCommand.specialHoeRightClick).append("]\n"); + debug.append("[melodyTooltips][").append(ToggleCommand.melodyTooltips).append("]\n"); debug.append("# Locations\n"); debug.append("[coords][").append(MoveCommand.coordsXY[0]).append(", ").append(MoveCommand.coordsXY[1]).append("]\n"); debug.append("[display][").append(MoveCommand.displayXY[0]).append(", ").append(MoveCommand.displayXY[1]).append("]\n"); -- cgit From 346880838127f5a6ba8e3025f92b4dc5e9d6dd85 Mon Sep 17 00:00:00 2001 From: CuzImClicks Date: Sat, 13 Mar 2021 18:33:54 +0100 Subject: updated README --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index 5005273..defecf8 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Discord Server: https://discord.gg/QsEkNQS - API commands - Update checker - Reparty command +- Highlight Slayer Bosses ## Commands - /dhelp - Returns this message in-game. -- cgit From 428f8e6ecdff1ea461d086633a86283048cedcfa Mon Sep 17 00:00:00 2001 From: RabbitType99 Date: Sat, 13 Mar 2021 20:11:26 +0100 Subject: Added Arachne highlighting, Added missing Text in README.md --- README.md | 5 +- .../java/me/Danker/commands/ToggleCommand.java | 14 +++- src/main/java/me/Danker/features/ArachneESP.java | 96 ++++++++++++++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 8 +- 4 files changed, 118 insertions(+), 5 deletions(-) create mode 100644 src/main/java/me/Danker/features/ArachneESP.java (limited to 'README.md') diff --git a/README.md b/README.md index defecf8..848251e 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Discord Server: https://discord.gg/QsEkNQS - Disable out of mana messages - Disable kill combo messages - Slayer item tracker +- Ghosts item tracker - RNGesus drop alerts - Click anywhere on-screen to open Maddox - Maddox menu keybind @@ -54,6 +55,8 @@ Discord Server: https://discord.gg/QsEkNQS - Update checker - Reparty command - Highlight Slayer Bosses +- Highlight Arachne + ## Commands - /dhelp - Returns this message in-game. @@ -62,7 +65,7 @@ Discord Server: https://discord.gg/QsEkNQS - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. - /loot [winter/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/f(1-7)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /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. diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 8840518..5b8e274 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -34,6 +34,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean outlineTextToggled; public static boolean cakeTimerToggled; public static boolean highlightSlayers; + public static boolean highlightArachne; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; @@ -92,7 +93,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/" + "startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" + "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/ " + - "/specialhoe/melodytooltips/highlightslayers/list>"; + "/specialhoe/melodytooltips/highlightslayers/highlightArachne/,list>"; } @Override @@ -103,7 +104,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "highlightArachne", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "shadowfury", "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", @@ -416,6 +417,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "HighlightSlayers", highlightSlayers); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Slayer Bosses " + DankersSkyblockMod.SECONDARY_COLOUR + highlightSlayers + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "highlighteArachne": + highlightArachne = !highlightArachne; + ConfigHandler.writeBooleanConfig("toggles", "HighlightSlayers", highlightSlayers); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Slayer Bosses " + DankersSkyblockMod.SECONDARY_COLOUR + highlightSlayers + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + @@ -463,7 +469,9 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Auto-swap to pick block " + DankersSkyblockMod.VALUE_COLOUR + swapToPickBlockToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Block Special Hoe right click " + DankersSkyblockMod.VALUE_COLOUR + specialHoeRightClick + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in Melody's Harp " + DankersSkyblockMod.VALUE_COLOUR + melodyTooltips + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Highlight Slayer Bosses " + DankersSkyblockMod.VALUE_COLOUR + highlightSlayers + DankersSkyblockMod.TYPE_COLOUR + " Highlight Slayer Bosses " + DankersSkyblockMod.VALUE_COLOUR + highlightSlayers + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Highlight Arachne Boss " + DankersSkyblockMod.VALUE_COLOUR + highlightArachne + )); break; default: diff --git a/src/main/java/me/Danker/features/ArachneESP.java b/src/main/java/me/Danker/features/ArachneESP.java new file mode 100644 index 0000000..c0aeab6 --- /dev/null +++ b/src/main/java/me/Danker/features/ArachneESP.java @@ -0,0 +1,96 @@ +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.entity.Entity; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityWolf; +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.ClientChatReceivedEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.entity.player.AttackEntityEvent; +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.List; + +/** + * @author RabbitType99 + */ + +public class ArachneESP { + + + static Entity arachne = null; + static boolean arachneActive = true; + public static final int ARACHANE_COLOUR = 0x00FF00; + + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + arachne = null; + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + //if (!Utils.inSkyblock) return; + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 2 == 0 && ToggleCommand.highlightArachne) { + if (world != null) { + if (!arachneActive) return; + List entities = world.getLoadedEntityList(); + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (Entity e : entities) { + System.out.println(e.getName()); + if (e.getName().contains("Arachne")) { + for (String s : scoreboard) { + if (ScoreboardHandler.cleanSB(s).contains("Spiders Den")) { + arachne = e; + } + } + } + + } + } + } + } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if (!Utils.inSkyblock) return; + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (message.contains("You dare call me, the queen of the dark, to accept you. I'll accept no excuses, you shall die!") || message.contains("Hahahahaha, YOU MORTAL FOOL! You dare to summon me at my full strength to this plane, you are seeking death. With this power, I will not let a weakling survive here, this land will be a brilliant place to start a new invasion of my empire. Tremble beneath me if you wish to survive!")){ + arachneActive = true; + } + if (message.contains("You are lucky this time, you only called out a portion of my power, if you dared to my face me at my peak, you would not survive!") || message.contains("How can this be...how could I lose to a puny being like you...I shall get my revenge") || message.contains("Arachne is bored with your feeble attempt!" )){ + arachneActive = false; + } + + } + + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (!Utils.inSkyblock) return; + if (arachneActive && ToggleCommand.highlightSlayers) { + AxisAlignedBB aabb = new AxisAlignedBB(arachne.posX - 0.5, arachne.posY - 1, arachne.posZ - 0.5, arachne.posX + 0.5, arachne.posY, arachne.posZ + 0.5); + Utils.draw3DBox(aabb, ARACHANE_COLOUR, event.partialTicks); + } + } + +} + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index fff4d9e..b0409fc 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -30,6 +30,7 @@ public class DankerGui extends GuiScreen { private GuiButton puzzleSolvers; private GuiButton experimentationTableSolvers; private GuiButton skillTracker; + private GuiButton highlightArachne; // Toggles private GuiButton gparty; private GuiButton coords; @@ -70,7 +71,7 @@ public class DankerGui extends GuiScreen { private GuiButton necronNotifications; private GuiButton bonzoTimer; private GuiButton autoSkillTracker; - + public DankerGui(int page) { this.page = page; } @@ -144,6 +145,9 @@ public class DankerGui extends GuiScreen { shadowFury = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Shadow Fury ability: " + Utils.getColouredBoolean(ToggleCommand.shadowFuryToggled)); specialHoe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Block Special Hoe right click: " + Utils.getColouredBoolean(ToggleCommand.specialHoeRightClick)); melodyTooltips = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips)); + //Page 7 + highlightArachne =new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne)); + switch (page) { case 1: @@ -211,6 +215,8 @@ public class DankerGui extends GuiScreen { this.buttonList.add(melodyTooltips); this.buttonList.add(backPage); break; + case 7: + this.buttonList.add(highlightArachne); } this.buttonList.add(githubLink); -- cgit From 668a2e184c270d01b259bd3f9269892a05bcc870 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 13 Mar 2021 21:38:33 -0500 Subject: Add ice walk puzzle solver --- README.md | 4 +- build.gradle | 2 +- src/main/java/me/Danker/DankersSkyblockMod.java | 3 +- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 + .../java/me/Danker/commands/ToggleCommand.java | 11 +- .../me/Danker/features/BlockPlacingFlowers.java | 44 ++++ .../puzzlesolvers/BlockPlacingFlowers.java | 44 ---- .../features/puzzlesolvers/IceWalkSolver.java | 287 +++++++++++++++++++++ .../features/puzzlesolvers/SilverfishSolver.java | 5 +- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 17 +- .../java/me/Danker/handlers/ConfigHandler.java | 2 + src/main/java/me/Danker/utils/IceWalkUtils.java | 99 +++++++ 13 files changed, 464 insertions(+), 57 deletions(-) create mode 100644 src/main/java/me/Danker/features/BlockPlacingFlowers.java delete mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java create mode 100644 src/main/java/me/Danker/utils/IceWalkUtils.java (limited to 'README.md') diff --git a/README.md b/README.md index 026d08d..0207b42 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Discord Server: https://discord.gg/QsEkNQS - 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, boulder, silverfish) +- Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe, boulder, silverfish, ice walk) - 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) @@ -54,7 +54,7 @@ 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/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. diff --git a/build.gradle b/build.gradle index 7fd2d15..79291b2 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.8.6-beta2" +version = "1.8.6-beta3" group= "me.Danker.DankersSkyblockMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index dbb79dc..ab042d6 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -59,7 +59,7 @@ import java.util.Map; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.6-beta2"; + public static final String VERSION = "1.8.6-beta3"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; @@ -104,6 +104,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new GolemSpawningAlert()); MinecraftForge.EVENT_BUS.register(new GpartyNotifications()); MinecraftForge.EVENT_BUS.register(new HideTooltipsInExperiments()); + MinecraftForge.EVENT_BUS.register(new IceWalkSolver()); MinecraftForge.EVENT_BUS.register(new LividSolver()); MinecraftForge.EVENT_BUS.register(new LootDisplay()); MinecraftForge.EVENT_BUS.register(new LootTracker()); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index c1ae5af..841d0b5 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" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index fff1ce7..bd92b3e 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -77,6 +77,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); debug.append("[boulderpuzzle][").append(ToggleCommand.boulderToggled).append("]\n"); debug.append("[silverfishpuzzle][").append(ToggleCommand.silverfishToggled).append("]\n"); + debug.append("[icewalkpuzzle][").append(ToggleCommand.iceWalkToggled).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"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 294cf1a..06619ac 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -58,6 +58,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean ticTacToeToggled; public static boolean boulderToggled; public static boolean silverfishToggled; + public static boolean iceWalkToggled; // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; @@ -83,7 +84,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "skill50display/outlinetext/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/" + "manamessages/killcombomessages/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/" + "notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/" + - "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/" + + "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/icewalkpuzzle/watchermessage/" + "startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" + "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @@ -105,7 +106,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "boulderpuzzle", - "silverfishpuzzle", "watchermessage", "startswithterminal", + "silverfishpuzzle", "icewalkpuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); @@ -324,6 +325,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", silverfishToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Silverfish puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + silverfishToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "icewalkpuzzle": + iceWalkToggled = !iceWalkToggled; + ConfigHandler.writeBooleanConfig("toggles", "IceWalkPuzzle", iceWalkToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ice walk puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + iceWalkToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "watchermessage": watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); @@ -416,6 +422,7 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 + " Silverfish puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + silverfishToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Ice walk puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + iceWalkToggled + "\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/BlockPlacingFlowers.java b/src/main/java/me/Danker/features/BlockPlacingFlowers.java new file mode 100644 index 0000000..9bfc986 --- /dev/null +++ b/src/main/java/me/Danker/features/BlockPlacingFlowers.java @@ -0,0 +1,44 @@ +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 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/BlockPlacingFlowers.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java deleted file mode 100644 index fe89fef..0000000 --- a/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java +++ /dev/null @@ -1,44 +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 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/IceWalkSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java new file mode 100644 index 0000000..eaabf6e --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java @@ -0,0 +1,287 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.IceWalkUtils; +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.EnumFacing; +import net.minecraft.util.Vec3; +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.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class IceWalkSolver { + + static boolean prevInIceWalkRoom = false; + static boolean inIceWalkRoom = false; + static BlockPos chest = null; + static EnumFacing silverfishRoomDirection = null; + static List threeByThreeRoute = new ArrayList<>(); + static List fiveByFiveRoute = new ArrayList<>(); + static List sevenBySevenRoute = new ArrayList<>(); + public static int ICE_WALK_LINE_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.iceWalkToggled && Utils.inDungeons && world != null && player != null) { + // multi thread block checking + new Thread(() -> { + boolean foundRoom = false; + prevInIceWalkRoom = inIceWalkRoom; + Iterable blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 27, 75, player.posZ - 27), new BlockPos(player.posX + 27, 75, player.posZ + 27)); + for (BlockPos blockPos : blocks) { + Block block = world.getBlockState(blockPos).getBlock(); + if (block == Blocks.chest) { + char[][] threeByThreeBoard = new char[4][3]; + char[][] fiveByFiveBoard = new char[6][5]; + char[][] sevenBySevenBoard = new char[8][7]; + + if (world.getBlockState(blockPos.add(0, 7, 2)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(0, -3, 2)).getBlock() == Blocks.stone_brick_stairs) { + silverfishRoomDirection = EnumFacing.NORTH; + } else if (world.getBlockState(blockPos.add(-2, 7, 0)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(-2, -3, 0)).getBlock() == Blocks.stone_brick_stairs) { + silverfishRoomDirection = EnumFacing.EAST; + } else if (world.getBlockState(blockPos.add(0, 7, -2)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(0, -3, -2)).getBlock() == Blocks.stone_brick_stairs) { + silverfishRoomDirection = EnumFacing.SOUTH; + } else if (world.getBlockState(blockPos.add(2, 7, 0)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(2, -3, 0)).getBlock() == Blocks.stone_brick_stairs) { + silverfishRoomDirection = EnumFacing.WEST; + } else { + return; + } + + foundRoom = true; + inIceWalkRoom = true; + if (!prevInIceWalkRoom) { + chest = blockPos; + switch (silverfishRoomDirection) { + case NORTH: + for (int row = chest.getZ() + 3, xIteration = 0; xIteration < 8; row++, xIteration++) { + for (int column = chest.getX() - 3, yIteration = 0; yIteration < 7; column++, yIteration++) { + if (world.getBlockState(new BlockPos(column, 72, row)).getBlock() != Blocks.air) { + sevenBySevenBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getZ() + 12, xIteration = 0; xIteration < 6; row++, xIteration++) { + for (int column = chest.getX() - 2, yIteration = 0; yIteration < 5; column++, yIteration++) { + if (world.getBlockState(new BlockPos(column, 71, row)).getBlock() != Blocks.air) { + fiveByFiveBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getZ() + 19, xIteration = 0; xIteration < 4; row++, xIteration++) { + for (int column = chest.getX() - 1, yIteration = 0; yIteration < 3; column++, yIteration++) { + if (world.getBlockState(new BlockPos(column, 70, row)).getBlock() != Blocks.air) { + threeByThreeBoard[xIteration][yIteration] = 'X'; + } + } + } + break; + case EAST: + for (int row = chest.getX() - 3, xIteration = 0; xIteration < 8; row--, xIteration++) { + for (int column = chest.getZ() - 3, yIteration = 0; yIteration < 7; column++, yIteration++) { + if (world.getBlockState(new BlockPos(row, 72, column)).getBlock() != Blocks.air) { + sevenBySevenBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getX() - 12, xIteration = 0; xIteration < 6; row--, xIteration++) { + for (int column = chest.getZ() - 2, yIteration = 0; yIteration < 5; column++, yIteration++) { + if (world.getBlockState(new BlockPos(row, 71, column)).getBlock() != Blocks.air) { + fiveByFiveBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getX() - 19, xIteration = 0; xIteration < 4; row--, xIteration++) { + for (int column = chest.getZ() - 1, yIteration = 0; yIteration < 3; column++, yIteration++) { + if (world.getBlockState(new BlockPos(row, 70, column)).getBlock() != Blocks.air) { + threeByThreeBoard[xIteration][yIteration] = 'X'; + } + } + } + break; + case SOUTH: + for (int row = chest.getZ() - 3, xIteration = 0; xIteration < 8; row--, xIteration++) { + for (int column = chest.getX() + 3, yIteration = 0; yIteration < 7; column--, yIteration++) { + if (world.getBlockState(new BlockPos(column, 72, row)).getBlock() != Blocks.air) { + sevenBySevenBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getZ() - 12, xIteration = 0; xIteration < 6; row--, xIteration++) { + for (int column = chest.getX() + 2, yIteration = 0; yIteration < 5; column--, yIteration++) { + if (world.getBlockState(new BlockPos(column, 71, row)).getBlock() != Blocks.air) { + fiveByFiveBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getZ() - 19, xIteration = 0; xIteration < 4; row--, xIteration++) { + for (int column = chest.getX() + 1, yIteration = 0; yIteration < 3; column--, yIteration++) { + if (world.getBlockState(new BlockPos(column, 70, row)).getBlock() != Blocks.air) { + threeByThreeBoard[xIteration][yIteration] = 'X'; + } + } + } + break; + case WEST: + for (int row = chest.getX() + 3, xIteration = 0; xIteration < 8; row++, xIteration++) { + for (int column = chest.getZ() + 3, yIteration = 0; yIteration < 7; column--, yIteration++) { + if (world.getBlockState(new BlockPos(row, 72, column)).getBlock() != Blocks.air) { + sevenBySevenBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getX() + 12, xIteration = 0; xIteration < 6; row++, xIteration++) { + for (int column = chest.getZ() + 2, yIteration = 0; yIteration < 5; column--, yIteration++) { + if (world.getBlockState(new BlockPos(row, 71, column)).getBlock() != Blocks.air) { + fiveByFiveBoard[xIteration][yIteration] = 'X'; + } + } + } + for (int row = chest.getX() + 19, xIteration = 0; xIteration < 4; row++, xIteration++) { + for (int column = chest.getZ() + 1, yIteration = 0; yIteration < 3; column--, yIteration++) { + if (world.getBlockState(new BlockPos(row, 70, column)).getBlock() != Blocks.air) { + threeByThreeBoard[xIteration][yIteration] = 'X'; + } + } + } + break; + } + System.out.println(Arrays.deepToString(threeByThreeBoard)); + System.out.println(Arrays.deepToString(fiveByFiveBoard)); + System.out.println(Arrays.deepToString(sevenBySevenBoard)); + + threeByThreeRoute = IceWalkUtils.solve(threeByThreeBoard); + fiveByFiveRoute = IceWalkUtils.solve(fiveByFiveBoard); + sevenBySevenRoute = IceWalkUtils.solve(sevenBySevenBoard); + } + } + } + if (!foundRoom) { + inIceWalkRoom = false; + reset(); + } + }).start(); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.iceWalkToggled && Utils.inDungeons && chest != null) { + if (threeByThreeRoute != null && threeByThreeRoute.size() > 1) { + for (int i = 0; i < threeByThreeRoute.size() - 1; i++) { + Vec3 pos1; + Vec3 pos2; + switch (silverfishRoomDirection) { + case NORTH: + pos1 = new Vec3(chest.getX() - 0.5 + threeByThreeRoute.get(i).column, 70.5, chest.getZ() + 19.5 + threeByThreeRoute.get(i).row); + pos2 = new Vec3(chest.getX() - 0.5 + threeByThreeRoute.get(i + 1).column, 70.5, chest.getZ() + 19.5 + threeByThreeRoute.get(i + 1).row); + break; + case EAST: + pos1 = new Vec3(chest.getX() - 18.5 - threeByThreeRoute.get(i).row, 70.5, chest.getZ() - 0.5 + threeByThreeRoute.get(i).column); + pos2 = new Vec3(chest.getX() - 18.5 - threeByThreeRoute.get(i + 1).row, 70.5, chest.getZ() - 0.5 + threeByThreeRoute.get(i + 1).column); + break; + case SOUTH: + pos1 = new Vec3(chest.getX() + 1.5 - threeByThreeRoute.get(i).column, 70.5, chest.getZ() - 18.5 - threeByThreeRoute.get(i).row); + pos2 = new Vec3(chest.getX() + 1.5 - threeByThreeRoute.get(i + 1).column, 70.5, chest.getZ() - 18.5 - threeByThreeRoute.get(i + 1).row); + break; + case WEST: + pos1 = new Vec3(chest.getX() + 19.5 + threeByThreeRoute.get(i).row, 70.5, chest.getZ() + 1.5 - threeByThreeRoute.get(i).column); + pos2 = new Vec3(chest.getX() + 19.5 + threeByThreeRoute.get(i + 1).row, 70.5, chest.getZ() + 1.5 - threeByThreeRoute.get(i + 1).column); + break; + default: + return; + } + Utils.draw3DLine(pos1, pos2, ICE_WALK_LINE_COLOUR, 5, true, event.partialTicks); + } + } + + if (fiveByFiveRoute != null && fiveByFiveRoute.size() > 1) { + for (int i = 0; i < fiveByFiveRoute.size() - 1; i++) { + Vec3 pos1; + Vec3 pos2; + switch (silverfishRoomDirection) { + case NORTH: + pos1 = new Vec3(chest.getX() - 1.5 + fiveByFiveRoute.get(i).column, 71.5, chest.getZ() + 12.5 + fiveByFiveRoute.get(i).row); + pos2 = new Vec3(chest.getX() - 1.5 + fiveByFiveRoute.get(i + 1).column, 71.5, chest.getZ() + 12.5 + fiveByFiveRoute.get(i + 1).row); + break; + case EAST: + pos1 = new Vec3(chest.getX() - 11.5 - fiveByFiveRoute.get(i).row, 71.5, chest.getZ() - 1.5 + fiveByFiveRoute.get(i).column); + pos2 = new Vec3(chest.getX() - 11.5 - fiveByFiveRoute.get(i + 1).row, 71.5, chest.getZ() - 1.5 + fiveByFiveRoute.get(i + 1).column); + break; + case SOUTH: + pos1 = new Vec3(chest.getX() + 2.5 - fiveByFiveRoute.get(i).column, 71.5, chest.getZ() - 11.5 - fiveByFiveRoute.get(i).row); + pos2 = new Vec3(chest.getX() + 2.5 - fiveByFiveRoute.get(i + 1).column, 71.5, chest.getZ() - 11.5 - fiveByFiveRoute.get(i + 1).row); + break; + case WEST: + pos1 = new Vec3(chest.getX() + 12.5 + fiveByFiveRoute.get(i).row, 71.5, chest.getZ() + 2.5 - fiveByFiveRoute.get(i).column); + pos2 = new Vec3(chest.getX() + 12.5 + fiveByFiveRoute.get(i + 1).row, 71.5, chest.getZ() + 2.5 - fiveByFiveRoute.get(i + 1).column); + break; + default: + return; + } + Utils.draw3DLine(pos1, pos2, ICE_WALK_LINE_COLOUR, 5, true, event.partialTicks); + } + } + + if (sevenBySevenRoute != null && sevenBySevenRoute.size() > 1) { + for (int i = 0; i < sevenBySevenRoute.size() - 1; i++) { + Vec3 pos1; + Vec3 pos2; + switch (silverfishRoomDirection) { + case NORTH: + pos1 = new Vec3(chest.getX() - 2.5 + sevenBySevenRoute.get(i).column, 72.5, chest.getZ() + 3.5 + sevenBySevenRoute.get(i).row); + pos2 = new Vec3(chest.getX() - 2.5 + sevenBySevenRoute.get(i + 1).column, 72.5, chest.getZ() + 3.5 + sevenBySevenRoute.get(i + 1).row); + break; + case EAST: + pos1 = new Vec3(chest.getX() - 2.5 - sevenBySevenRoute.get(i).row, 72.5, chest.getZ() - 2.5 + sevenBySevenRoute.get(i).column); + pos2 = new Vec3(chest.getX() - 2.5 - sevenBySevenRoute.get(i + 1).row, 72.5, chest.getZ() - 2.5 + sevenBySevenRoute.get(i + 1).column); + break; + case SOUTH: + pos1 = new Vec3(chest.getX() + 3.5 - sevenBySevenRoute.get(i).column, 72.5, chest.getZ() - 2.5 - sevenBySevenRoute.get(i).row); + pos2 = new Vec3(chest.getX() + 3.5 - sevenBySevenRoute.get(i + 1).column, 72.5, chest.getZ() - 2.5 - sevenBySevenRoute.get(i + 1).row); + break; + case WEST: + pos1 = new Vec3(chest.getX() + 3.5 + sevenBySevenRoute.get(i).row, 72.5, chest.getZ() + 3.5 - sevenBySevenRoute.get(i).column); + pos2 = new Vec3(chest.getX() + 3.5 + sevenBySevenRoute.get(i + 1).row, 72.5, chest.getZ() + 3.5 - sevenBySevenRoute.get(i + 1).column); + break; + default: + return; + } + Utils.draw3DLine(pos1, pos2, ICE_WALK_LINE_COLOUR, 5, true, event.partialTicks); + } + } + } + } + + static void reset() { + silverfishRoomDirection = null; + chest = null; + threeByThreeRoute.clear(); + fiveByFiveRoute.clear(); + sevenBySevenRoute.clear(); + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java index c07524d..575dcd3 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java @@ -12,7 +12,10 @@ import net.minecraft.entity.monster.EntitySilverfish; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 3864b80..3bb16a0 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -24,6 +24,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton ticTacToe; private GuiButton boulder; private GuiButton silverfish; + private GuiButton iceWalk; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -61,11 +62,12 @@ public class PuzzleSolversGui extends GuiScreen { boulder = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled)); // Page 2 silverfish = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled)); - startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); - selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); - clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); - blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + iceWalk = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Ice Walk Solver: " + Utils.getColouredBoolean(ToggleCommand.iceWalkToggled)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -80,6 +82,7 @@ public class PuzzleSolversGui extends GuiScreen { break; case 2: this.buttonList.add(silverfish); + this.buttonList.add(iceWalk); this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); @@ -137,6 +140,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.silverfishToggled = !ToggleCommand.silverfishToggled; ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", ToggleCommand.silverfishToggled); silverfish.displayString = "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled); + } else if (button == iceWalk) { + ToggleCommand.iceWalkToggled = !ToggleCommand.iceWalkToggled; + ConfigHandler.writeBooleanConfig("toggles", "IceWalkPuzzle", ToggleCommand.iceWalkToggled); + iceWalk.displayString = "Ice Walk Solver: " + Utils.getColouredBoolean(ToggleCommand.iceWalkToggled); } 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 52b1883..19edeff 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -254,6 +254,7 @@ public class ConfigHandler { ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); ToggleCommand.boulderToggled = initBoolean("toggles", "BoulderPuzzle", false); ToggleCommand.silverfishToggled = initBoolean("toggles", "SilverfishPuzzle", false); + ToggleCommand.iceWalkToggled = initBoolean("toggles", "IceWalkPuzzle", false); ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); @@ -513,6 +514,7 @@ public class ConfigHandler { BoulderSolver.BOULDER_COLOUR = initInt("colors", "boulder", 0x197F19); BoulderSolver.BOULDER_ARROW_COLOUR = initInt("colors", "boulderArrow", 0x006000); SilverfishSolver.SILVERFISH_LINE_COLOUR = initInt("colors", "silverfishLine", 0x40FF40); + IceWalkSolver.ICE_WALK_LINE_COLOUR = initInt("colors", "iceWalkLine", 0x40FF40); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); diff --git a/src/main/java/me/Danker/utils/IceWalkUtils.java b/src/main/java/me/Danker/utils/IceWalkUtils.java new file mode 100644 index 0000000..8164fe1 --- /dev/null +++ b/src/main/java/me/Danker/utils/IceWalkUtils.java @@ -0,0 +1,99 @@ +package me.Danker.utils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class IceWalkUtils { + + public static List solve(char[][] board) { + Point startPos = new Point(board.length - 1, board[0].length / 2); + Point endPos = new Point(0, board[0].length / 2); + List route = new ArrayList<>(); + route.add(startPos); + return findSolution(board, startPos, endPos, route); + } + + public static List findSolution(char[][] board, Point startPos, Point endPos, List route) { + for (Direction direction : Direction.values()) { + Point nextPoint = move(board, startPos, direction); + if (nextPoint == null || route.contains(nextPoint)) continue; + List newRoute = new ArrayList<>(route); + newRoute.add(nextPoint); + if (nextPoint.equals(endPos) && isComplete(board, newRoute)) return newRoute; + List solution = findSolution(board, nextPoint, endPos, newRoute); + if (solution == null) continue; + return solution; + } + return null; + } + + public static Point move(char[][] board, Point pos, Direction direction) { + switch (direction) { + case UP: + if (pos.row != 0 && board[pos.row - 1][pos.column] != 'X') { + return new Point(pos.row - 1, pos.column); + } + break; + case DOWN: + if (pos.row != board.length - 1 && board[pos.row + 1][pos.column] != 'X') { + return new Point(pos.row + 1, pos.column); + } + break; + case LEFT: + if (pos.column != 0 && board[pos.row][pos.column - 1] != 'X') { + return new Point(pos.row, pos.column - 1); + } + break; + case RIGHT: + if (pos.column != board[0].length - 1 && board[pos.row][pos.column + 1] != 'X') { + return new Point(pos.row, pos.column + 1); + } + break; + } + return null; + } + + public static boolean isComplete(char[][] board, List route) { + for (int row = 0; row < board.length; row++) { + for (int column = 0; column < board[0].length; column++) { + if (board[row][column] != 'X' && !route.contains(new Point(row, column))) return false; + } + } + return true; + } + + public static class Point { + + public int row; + public int column; + + public Point(int row, int column) { + this.row = row; + this.column = column; + } + + @Override + public int hashCode() { + return Objects.hash(row, column); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Point) { + Point point = (Point) obj; + return row == point.row && column == point.column; + } + return false; + } + + } + + enum Direction { + UP, + DOWN, + LEFT, + RIGHT + } + +} -- cgit From e1fd25b6841e94e0b1861528f3f05378fc23a04f Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 14 Mar 2021 22:34:12 -0400 Subject: Add support for rev 5 and auto slayer --- README.md | 2 +- .../me/Danker/commands/BlockSlayerCommand.java | 7 ++++-- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- src/main/java/me/Danker/commands/LootCommand.java | 4 ++++ .../java/me/Danker/features/loot/LootDisplay.java | 8 +++++++ .../java/me/Danker/features/loot/LootTracker.java | 22 ++++++++++++++++--- src/main/java/me/Danker/gui/OnlySlayerGui.java | 25 +++++++++++++++++----- .../java/me/Danker/handlers/ConfigHandler.java | 2 ++ 8 files changed, 60 insertions(+), 12 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0207b42..b9abb21 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Discord Server: https://discord.gg/QsEkNQS - /dungeons [player] - Uses API to get dungeon levels of a person. If no name is provided, it checks yours. - /importfishing - Imports your fishing stats from your latest profile to your fishing tracker using the API. - /sbplayers - Uses API to find how many players are on each Skyblock island. -- /onlyslayer <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. +- /onlyslayer <1/2/3/4/5> - Stops you from starting a slayer quest other than the one specified. - /skilltracker - Text display for skill xp/hour. - /reparty - Disbands and reparties all members in the party diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java index c0beb42..09da5d6 100644 --- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java +++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java @@ -21,7 +21,7 @@ public class BlockSlayerCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <1/2/3/4>"; + return "/" + getCommandName() + " <1/2/3/4/5>"; } @Override @@ -34,7 +34,7 @@ public class BlockSlayerCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf"); } else if (args.length == 2) { - return getListOfStringsMatchingLastWord(args, "1", "2", "3", "4"); + return getListOfStringsMatchingLastWord(args, "1", "2", "3", "4", "5"); } return null; } @@ -84,6 +84,9 @@ public class BlockSlayerCommand extends CommandBase { case 4: BlockWrongSlayer.onlySlayerNumber = "IV"; break; + case 5: + BlockWrongSlayer.onlySlayerNumber = "V"; + break; default: BlockWrongSlayer.onlySlayerName = ""; BlockWrongSlayer.onlySlayerNumber = ""; diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 841d0b5..c431123 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -52,7 +52,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /dungeons [player] " + EnumChatFormatting.AQUA + " - Uses API to get dungeon levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" + 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 + " /onlyslayer <1/2/3/4/5>" + 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" + diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 3dba27d..5502068 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -227,6 +227,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.RED + " Revenant Catalysts: " + LootTracker.zombieRevCatasSession + "\n" + EnumChatFormatting.DARK_GREEN + " Snake Runes: " + LootTracker.zombieSnakesSession + "\n" + EnumChatFormatting.GOLD + " Scythe Blades: " + LootTracker.zombieScythesSession + "\n" + + EnumChatFormatting.RED + " Shard of the Shreddeds: " + LootTracker.zombieShardsSession + "\n" + + EnumChatFormatting.RED + " Warden Hearts: " + LootTracker.zombieWardenHeartsSession + "\n" + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + " -------------------")); @@ -261,6 +263,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.RED + " Revenant Catalysts: " + LootTracker.zombieRevCatas + "\n" + EnumChatFormatting.DARK_GREEN + " Snake Runes: " + LootTracker.zombieSnakes + "\n" + EnumChatFormatting.GOLD + " Scythe Blades: " + LootTracker.zombieScythes + "\n" + + EnumChatFormatting.RED + " Shard of the Shreddeds: " + LootTracker.zombieShards + "\n" + + EnumChatFormatting.RED + " Warden Hearts: " + LootTracker.zombieWardenHearts + "\n" + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + " -------------------")); diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 363b70c..f51157b 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -221,6 +221,8 @@ public class LootDisplay { EnumChatFormatting.RED + "Revenant Catalysts:\n" + EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" + EnumChatFormatting.GOLD + "Scythe Blades:\n" + + EnumChatFormatting.RED + "Shard of Shreddeds:\n" + + EnumChatFormatting.RED + "Warden Hearts:\n" + EnumChatFormatting.AQUA + "Time Since RNG:\n" + EnumChatFormatting.AQUA + "Bosses Since RNG:"; countText = EnumChatFormatting.GOLD + nf.format(LootTracker.zombieRevs) + "\n" + @@ -233,6 +235,8 @@ public class LootDisplay { EnumChatFormatting.RED + LootTracker.zombieRevCatas + "\n" + EnumChatFormatting.DARK_GREEN + LootTracker.zombieSnakes + "\n" + EnumChatFormatting.GOLD + LootTracker.zombieScythes + "\n" + + EnumChatFormatting.RED + LootTracker.zombieShards + "\n" + + EnumChatFormatting.RED + LootTracker.zombieWardenHearts + "\n" + EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; @@ -263,6 +267,8 @@ public class LootDisplay { EnumChatFormatting.RED + "Revenant Catalysts:\n" + EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" + EnumChatFormatting.GOLD + "Scythe Blades:\n" + + EnumChatFormatting.RED + "Shard of Shreddeds:\n" + + EnumChatFormatting.RED + "Warden Hearts:\n" + EnumChatFormatting.AQUA + "Time Since RNG:\n" + EnumChatFormatting.AQUA + "Bosses Since RNG:"; countText = EnumChatFormatting.GOLD + nf.format(LootTracker.zombieRevsSession) + "\n" + @@ -275,6 +281,8 @@ public class LootDisplay { EnumChatFormatting.RED + LootTracker.zombieRevCatasSession + "\n" + EnumChatFormatting.DARK_GREEN + LootTracker.zombieSnakesSession + "\n" + EnumChatFormatting.GOLD + LootTracker.zombieScythes + "\n" + + EnumChatFormatting.RED + LootTracker.zombieShardsSession + "\n" + + EnumChatFormatting.RED + LootTracker.zombieWardenHeartsSession + "\n" + EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java index f7f7044..68cd8b0 100644 --- a/src/main/java/me/Danker/features/loot/LootTracker.java +++ b/src/main/java/me/Danker/features/loot/LootTracker.java @@ -56,6 +56,8 @@ public class LootTracker { public static int zombieRevCatas; public static int zombieSnakes; public static int zombieScythes; + public static int zombieShards; + public static int zombieWardenHearts; public static double zombieTime; public static int zombieBosses; @@ -216,6 +218,8 @@ public class LootTracker { public static int zombieRevCatasSession = 0; public static int zombieSnakesSession = 0; public static int zombieScythesSession = 0; + public static int zombieShardsSession = 0; + public static int zombieWardenHeartsSession = 0; public static double zombieTimeSession = -1; public static int zombieBossesSession = -1; @@ -373,7 +377,7 @@ public class LootTracker { } // Wolf - if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { + if (message.contains(" Wolf Slayer LVL ")) { wolfSvens++; wolfSvensSession++; if (wolfBosses != -1) { @@ -416,7 +420,7 @@ public class LootTracker { 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 + } else if (message.contains(" Spider Slayer LVL ")) { // Spider spiderTarantulas++; spiderTarantulasSession++; if (spiderBosses != -1) { @@ -457,7 +461,7 @@ public class LootTracker { 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 + } else if (message.contains(" Zombie Slayer LVL ")) { // Zombie zombieRevs++; zombieRevsSession++; if (zombieBosses != -1) { @@ -502,6 +506,18 @@ public class LootTracker { zombieScythesSession++; ConfigHandler.writeIntConfig("zombie", "scythe", zombieScythes); if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SCYTHE BLADE!", 5); + } else if (message.contains("INSANE DROP! (Shard of the Shredded)")) { + zombieRNG = true; + zombieShards++; + zombieShardsSession++; + ConfigHandler.writeIntConfig("zombie", "shard", zombieShards); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "SHARD OF THE SHREDDED!", 5); + } else if (message.contains("INSANE DROP! (Warden Heart)")) { + zombieRNG = true; + zombieWardenHearts++; + zombieWardenHeartsSession++; + ConfigHandler.writeIntConfig("zombie", "heart", zombieWardenHearts); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "WARDEN HEART!", 5); } if (wolfRNG) { diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index 552a354..6ae1490 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -23,6 +23,7 @@ public class OnlySlayerGui extends GuiScreen { private GuiButton two; private GuiButton three; private GuiButton four; + private GuiButton five; @Override public boolean doesGuiPauseGame() { @@ -48,9 +49,14 @@ public class OnlySlayerGui extends GuiScreen { case "III": onlyNumberInt = 3; break; - default: + case "IV": onlyNumberInt = 4; break; + case "V": + onlyNumberInt = 5; + break; + default: + return; } goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); @@ -58,10 +64,11 @@ public class OnlySlayerGui extends GuiScreen { zombie = new GuiButton(0, width / 2 - 200, (int) (height * 0.4), 120, 20, "Zombie"); spider = new GuiButton(0, width / 2 - 60, (int) (height * 0.4), 120, 20, "Spider"); wolf = new GuiButton(0, width / 2 + 80, (int) (height * 0.4), 120, 20, "Wolf"); - one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 85, 20, "I"); - two = new GuiButton(0, width / 2 - 95, (int) (height * 0.6), 85, 20, "II"); - three = new GuiButton(0, width / 2 + 10, (int) (height * 0.6), 85, 20, "III"); - four = new GuiButton(0, width / 2 + 115, (int) (height * 0.6), 85, 20, "IV"); + one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 60, 20, "I"); + two = new GuiButton(0, width / 2 - 110, (int) (height * 0.6), 60, 20, "II"); + three = new GuiButton(0, width / 2 - 30, (int) (height * 0.6), 60, 20, "III"); + four = new GuiButton(0, width / 2 + 50, (int) (height * 0.6), 60, 20, "IV"); + five = new GuiButton(0, width / 2 + 130, (int) (height * 0.6), 60, 20, "V"); this.buttonList.add(off); this.buttonList.add(zombie); @@ -71,6 +78,7 @@ public class OnlySlayerGui extends GuiScreen { this.buttonList.add(two); this.buttonList.add(three); this.buttonList.add(four); + this.buttonList.add(five); this.buttonList.add(goBack); } @@ -115,6 +123,8 @@ public class OnlySlayerGui extends GuiScreen { onlyNumberInt = 3; } else if (button == four) { onlyNumberInt = 4; + } else if (button == five) { + onlyNumberInt = 5; } String onlyNumber; @@ -129,6 +139,11 @@ public class OnlySlayerGui extends GuiScreen { onlyNumber = "III"; break; case 4: + onlyNumber = "IV"; + break; + case 5: + onlyNumber = "V"; + break; default: onlyNumber = "IV"; } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 19edeff..cb04daa 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -315,6 +315,8 @@ public class ConfigHandler { LootTracker.zombieRevCatas = initInt("zombie", "revCatalyst", 0); LootTracker.zombieSnakes = initInt("zombie", "snake", 0); LootTracker.zombieScythes = initInt("zombie", "scythe", 0); + LootTracker.zombieShards = initInt("zombie", "shard", 0); + LootTracker.zombieWardenHearts = initInt("zombie", "heart", 0); LootTracker.zombieTime = initDouble("zombie", "timeRNG", -1); LootTracker.zombieBosses = initInt("zombie", "bossRNG", -1); -- cgit From 42449d4110853d43b40c50f96c2814b865d24f8d Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 18 Mar 2021 18:24:48 -0400 Subject: Add custom dungeon boss music --- README.md | 15 ++- src/main/java/me/Danker/DankersSkyblockMod.java | 59 ++++++----- .../me/Danker/commands/CustomMusicCommand.java | 70 ++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 5 +- .../java/me/Danker/commands/DankerGuiCommand.java | 3 +- .../java/me/Danker/commands/ToggleCommand.java | 25 ++++- src/main/java/me/Danker/features/CustomMusic.java | 117 +++++++++++++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 17 ++- .../java/me/Danker/handlers/ConfigHandler.java | 2 + 9 files changed, 279 insertions(+), 34 deletions(-) create mode 100644 src/main/java/me/Danker/commands/CustomMusicCommand.java create mode 100644 src/main/java/me/Danker/features/CustomMusic.java (limited to 'README.md') diff --git a/README.md b/README.md index b9abb21..dfc8ce4 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Discord Server: https://discord.gg/QsEkNQS - Watcher ready message - Catacombs F7 Stage 3 solvers (Starts with letter, select all colour, ignore arrows on sea lanterns) - Find correct Livid (with graphic display of HP) +- Use custom music in dungeon boss room - Experimentation solvers (Ultrasequencer, Chronomatron, Superpairs) - Hide tooltips in experiment addons - Pet background colors based on level @@ -54,7 +55,7 @@ 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/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. @@ -75,11 +76,23 @@ Discord Server: https://discord.gg/QsEkNQS - /onlyslayer <1/2/3/4/5> - Stops you from starting a slayer quest other than the one specified. - /skilltracker - Text display for skill xp/hour. - /reparty - Disbands and reparties all members in the party +- /dsmmusic - Stops or reloads the custom music. ## Keybinds - Open Maddox menu - M by default. +- Regular Ability - Numpad 4 by default. - Start/Stop Skill Tracker - Numpad 5 by default. +## Custom Music +- Supported audio formats: + - .wav + - .mid + - .aiff + - .au + - .rmf +- For the following custom music, place a supported music file with the given name in the `.minecraft/config/dsmmusic` folder. + - Dungeon boss music: `dungeonboss` + ### Notes - Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker. - API commands may take a while depending on your internet connection. The API may also go down. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index ab042d6..4a40a61 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -53,6 +53,9 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToSe import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.UnsupportedAudioFileException; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -70,6 +73,7 @@ public class DankersSkyblockMod { static boolean OAMWarning = false; public static String guiToOpen = null; public static boolean firstLaunch = false; + public static String configDirectory; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -97,6 +101,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new ChronomatronSolver()); MinecraftForge.EVENT_BUS.register(new ClickInOrderSolver()); MinecraftForge.EVENT_BUS.register(new CreeperSolver()); + MinecraftForge.EVENT_BUS.register(new CustomMusic()); MinecraftForge.EVENT_BUS.register(new DungeonTimer()); MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); @@ -145,31 +150,35 @@ public class DankersSkyblockMod { } @EventHandler - public void preInit(final FMLPreInitializationEvent event) { - ClientCommandHandler.instance.registerCommand(new ToggleCommand()); - ClientCommandHandler.instance.registerCommand(new SetkeyCommand()); - ClientCommandHandler.instance.registerCommand(new GetkeyCommand()); - ClientCommandHandler.instance.registerCommand(new LootCommand()); - ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand()); - ClientCommandHandler.instance.registerCommand(new DisplayCommand()); - ClientCommandHandler.instance.registerCommand(new MoveCommand()); - ClientCommandHandler.instance.registerCommand(new SlayerCommand()); - ClientCommandHandler.instance.registerCommand(new SkillsCommand()); - ClientCommandHandler.instance.registerCommand(new GuildOfCommand()); - ClientCommandHandler.instance.registerCommand(new DHelpCommand()); - ClientCommandHandler.instance.registerCommand(new PetsCommand()); - ClientCommandHandler.instance.registerCommand(new BankCommand()); - ClientCommandHandler.instance.registerCommand(new ArmourCommand()); - ClientCommandHandler.instance.registerCommand(new ImportFishingCommand()); - ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); - ClientCommandHandler.instance.registerCommand(new ScaleCommand()); - ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); - ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); - ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); - ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); - ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); - ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); - ClientCommandHandler.instance.registerCommand(new FairySoulsCommand()); + public void preInit(final FMLPreInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { + ClientCommandHandler.instance.registerCommand(new ArmourCommand()); + ClientCommandHandler.instance.registerCommand(new BankCommand()); + ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); + ClientCommandHandler.instance.registerCommand(new CustomMusicCommand()); + ClientCommandHandler.instance.registerCommand(new DHelpCommand()); + ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); + ClientCommandHandler.instance.registerCommand(new DisplayCommand()); + ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); + ClientCommandHandler.instance.registerCommand(new FairySoulsCommand()); + ClientCommandHandler.instance.registerCommand(new GetkeyCommand()); + ClientCommandHandler.instance.registerCommand(new GuildOfCommand()); + ClientCommandHandler.instance.registerCommand(new ImportFishingCommand()); + ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); + ClientCommandHandler.instance.registerCommand(new LootCommand()); + ClientCommandHandler.instance.registerCommand(new MoveCommand()); + ClientCommandHandler.instance.registerCommand(new PetsCommand()); + ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand()); + ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); + ClientCommandHandler.instance.registerCommand(new ScaleCommand()); + ClientCommandHandler.instance.registerCommand(new SetkeyCommand()); + ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); + ClientCommandHandler.instance.registerCommand(new SkillsCommand()); + ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); + ClientCommandHandler.instance.registerCommand(new SlayerCommand()); + ClientCommandHandler.instance.registerCommand(new ToggleCommand()); + + configDirectory = event.getModConfigurationDirectory().toString(); + CustomMusic.init(configDirectory); } @EventHandler diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java new file mode 100644 index 0000000..5364930 --- /dev/null +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -0,0 +1,70 @@ +package me.Danker.commands; + +import me.Danker.DankersSkyblockMod; +import me.Danker.features.CustomMusic; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; + +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.UnsupportedAudioFileException; +import java.io.IOException; +import java.util.List; + +public class CustomMusicCommand extends CommandBase { + + @Override + public String getCommandName() { + return "dsmmusic"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return "/" + getCommandName() + " "; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + return getListOfStringsMatchingLastWord(args, "stop", "reload"); + } + return null; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + final EntityPlayer player = (EntityPlayer)arg0; + + if (arg1.length == 0) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + return; + } + + switch (arg1[0].toLowerCase()) { + case "stop": + if (CustomMusic.dungeonboss != null) CustomMusic.dungeonboss.stop(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Stopped custom music.")); + break; + case "reload": + try { + CustomMusic.init(DankersSkyblockMod.configDirectory); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Reloaded custom music.")); + } catch (IOException | LineUnavailableException | UnsupportedAudioFileException e) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error occurred while trying to reload music.")); + e.printStackTrace(); + } + break; + default: + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + } + } + +} diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index c431123..0348574 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,7 +54,8 @@ 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/5>" + 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.GOLD + " /reparty" + EnumChatFormatting.AQUA + " - Disbands and reparties all members in the party.\n" + + EnumChatFormatting.GOLD + " /dsmmusic " + EnumChatFormatting.AQUA + " - Stops or reloads the custom music.\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 bd92b3e..6774d5a 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -89,6 +89,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[superpairs][").append(ToggleCommand.superpairsToggled).append("]\n"); debug.append("[hidetooltipsinaddons][").append(ToggleCommand.hideTooltipsInExperimentAddonsToggled).append("]\n"); debug.append("[pickblock][").append(ToggleCommand.swapToPickBlockToggled).append("]\n"); + debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); debug.append("# Locations\n"); debug.append("[coords][").append(MoveCommand.coordsXY[0]).append(", ").append(MoveCommand.coordsXY[1]).append("]\n"); debug.append("[display][").append(MoveCommand.displayXY[0]).append(", ").append(MoveCommand.displayXY[1]).append("]\n"); @@ -110,7 +111,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("\n"); } else { for (ResourcePackRepository.Entry resource : Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries()) { - debug.append("< ").append(StringUtils.stripControlCodes(resource.getResourcePackName())).append(" >\n"); + debug.append("<").append(StringUtils.stripControlCodes(resource.getResourcePackName())).append(">\n"); } } debug.append("```"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 06619ac..2cc4745 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -1,6 +1,7 @@ package me.Danker.commands; import me.Danker.DankersSkyblockMod; +import me.Danker.features.CustomMusic; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -70,7 +71,9 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean chronomatronToggled; public static boolean superpairsToggled; public static boolean hideTooltipsInExperimentAddonsToggled; - + // Custom Music + public static boolean dungeonBossMusic; + @Override public String getCommandName() { return "toggle"; @@ -86,7 +89,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/" + "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/icewalkpuzzle/watchermessage/" + "startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" + - "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; + "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/" + + "pickblock/dungeonbossmusic/list>"; } @Override @@ -109,7 +113,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "silverfishpuzzle", "icewalkpuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", - "hidetooltipsinaddons", "pickblock", "list"); + "hidetooltipsinaddons", "pickblock", "dungeonbossmusic", "list"); } return null; } @@ -385,6 +389,18 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "PickBlock", swapToPickBlockToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto-swap to pick block has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + swapToPickBlockToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "dungeonbossmusic": + dungeonBossMusic = !dungeonBossMusic; + if (CustomMusic.dungeonboss != null) { + if (dungeonBossMusic) { + CustomMusic.start(); + } else { + CustomMusic.dungeonboss.stop(); + } + } + ConfigHandler.writeBooleanConfig("toggles", "DungeonBossMusic", dungeonBossMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom dungeon boss music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonBossMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + @@ -431,7 +447,8 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Superpairs solver: " + DankersSkyblockMod.VALUE_COLOUR + superpairsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in experiment addons: " + DankersSkyblockMod.VALUE_COLOUR + hideTooltipsInExperimentAddonsToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Auto-swap to pick block " + DankersSkyblockMod.VALUE_COLOUR + swapToPickBlockToggled + DankersSkyblockMod.TYPE_COLOUR + " Auto-swap to pick block: " + DankersSkyblockMod.VALUE_COLOUR + swapToPickBlockToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic )); break; default: diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java new file mode 100644 index 0000000..8617e7b --- /dev/null +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -0,0 +1,117 @@ +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.client.entity.EntityPlayerSP; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.sound.PlaySoundEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import javax.sound.sampled.*; +import java.io.File; +import java.io.IOException; +import java.util.List; + +public class CustomMusic { + + static boolean prevInDungeonBossRoom = false; + static boolean inDungeonBossRoom = false; + public static Clip dungeonboss; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + reset(); + } + + @SubscribeEvent(priority = EventPriority.LOW) + 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 % 10 == 0) { + if (ToggleCommand.dungeonBossMusic && Utils.inDungeons && world != null && player != null) { + prevInDungeonBossRoom = inDungeonBossRoom; + List scoreboard = ScoreboardHandler.getSidebarLines(); + if (scoreboard.size() > 2) { + String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); + String secondLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 2)); + if (firstLine.contains("30,30") || // F1 + firstLine.contains("30,125") || // F2 + firstLine.contains("30,225") || // F3 + secondLine.contains("- Healthy") || // F3 + firstLine.contains("30,344") || // F4 + firstLine.contains("livid") || // F5 + firstLine.contains("sadan") || // F6 + firstLine.contains("necron")) { // F7 + + inDungeonBossRoom = true; + if (!prevInDungeonBossRoom && dungeonboss != null) { + start(); + } + } else { + reset(); + } + } + } + } + } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if (!Utils.inDungeons) return; + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (message.contains("EXTRA STATS ")) { + if (dungeonboss != null) dungeonboss.stop(); + } + } + + @SubscribeEvent + public void onSound(PlaySoundEvent event) { + if (ToggleCommand.dungeonBossMusic && Utils.inDungeons && inDungeonBossRoom) { + if (event.name.startsWith("note.")) event.setCanceled(true); + } + } + + public static void init(String configDirectory) throws IOException, LineUnavailableException, UnsupportedAudioFileException { + if (configDirectory == null) return; + File directory = new File(configDirectory + "\\dsmmusic"); + if (!directory.exists()) directory.mkdir(); + + reset(); + + dungeonboss = AudioSystem.getClip(); + File dungeonBossFile = new File(configDirectory + "\\dsmmusic\\dungeonboss.wav"); + if (dungeonBossFile.exists()) { + AudioInputStream ais = AudioSystem.getAudioInputStream(dungeonBossFile); + dungeonboss.open(ais); + + FloatControl volume = (FloatControl) dungeonboss.getControl(FloatControl.Type.MASTER_GAIN); + volume.setValue(-20F); + } + } + + static void reset() { + inDungeonBossRoom = false; + if (dungeonboss != null) dungeonboss.stop(); + } + + public static void start() { + if (dungeonboss != null && inDungeonBossRoom) { + dungeonboss.setMicrosecondPosition(0); + dungeonboss.start(); + dungeonboss.loop(Clip.LOOP_CONTINUOUSLY); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index a6d2bb1..2d07f27 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -2,6 +2,7 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.features.CustomMusic; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; @@ -46,6 +47,7 @@ public class DankerGui extends GuiScreen { private GuiButton skill50Display; private GuiButton outlineText; private GuiButton cakeTimer; + private GuiButton dungeonBossMusic; // Chat Messages private GuiButton lividDagger; private GuiButton sceptreMessages; @@ -55,7 +57,7 @@ public class DankerGui extends GuiScreen { private GuiButton cooldownMessages; private GuiButton manaMessages; private GuiButton killComboMessages; - //Dungeons + // Dungeons private GuiButton dungeonTimer; private GuiButton lowHealthNotify; private GuiButton lividSolver; @@ -138,6 +140,7 @@ public class DankerGui extends GuiScreen { necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); bonzoTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); autoSkillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); + dungeonBossMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic)); switch (page) { case 1: @@ -199,6 +202,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(necronNotifications); this.buttonList.add(bonzoTimer); this.buttonList.add(autoSkillTracker); + this.buttonList.add(dungeonBossMusic); this.buttonList.add(backPage); break; } @@ -386,6 +390,17 @@ public class DankerGui extends GuiScreen { ToggleCommand.killComboMessages = !ToggleCommand.killComboMessages; ConfigHandler.writeBooleanConfig("toggles", "KillComboMessages", ToggleCommand.killComboMessages); killComboMessages.displayString = "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages); + } else if (button == dungeonBossMusic) { + ToggleCommand.dungeonBossMusic = !ToggleCommand.dungeonBossMusic; + if (CustomMusic.dungeonboss != null) { + if (ToggleCommand.dungeonBossMusic) { + CustomMusic.start(); + } else { + CustomMusic.dungeonboss.stop(); + } + } + ConfigHandler.writeBooleanConfig("toggles", "DungeonBossMusic", ToggleCommand.dungeonBossMusic); + dungeonBossMusic.displayString = "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index cb04daa..6b17b3c 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -265,6 +265,8 @@ public class ConfigHandler { ToggleCommand.chronomatronToggled = initBoolean("toggles", "Chronomatron", false); ToggleCommand.superpairsToggled = initBoolean("toggles", "Superpairs", false); ToggleCommand.hideTooltipsInExperimentAddonsToggled = initBoolean("toggles", "HideTooltipsInExperimentAddons", false); + // Custom Music + ToggleCommand.dungeonBossMusic = initBoolean("toggles", "DungeonBossMusic", false); // API if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); -- cgit From c63fa1b2d1c2c3b8704337f7908e4dd18bbc1733 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 21 Mar 2021 21:52:02 -0400 Subject: Fix custom music file on non-windows operating systems --- README.md | 10 ++-------- src/main/java/me/Danker/features/CustomMusic.java | 5 +++-- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6f484d7..a2f0227 100644 --- a/README.md +++ b/README.md @@ -93,14 +93,8 @@ Discord Server: https://discord.gg/QsEkNQS - Start/Stop Skill Tracker - Numpad 5 by default. ## Custom Music -- Supported audio formats: - - .wav - - .mid - - .aiff - - .au - - .rmf -- For the following custom music, place a supported music file with the given name in the `.minecraft/config/dsmmusic` folder. - - Dungeon boss music: `dungeonboss` +- To use custom music, place a music file with the given name in the `.minecraft/config/dsmmusic` folder and enable the custom song in /dsm. + - Dungeon boss music: `dungeonboss.wav` ### Notes - Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker. diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index d2d6b6f..3c411d8 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -85,13 +85,14 @@ public class CustomMusic { public static void init(String configDirectory) throws IOException, LineUnavailableException, UnsupportedAudioFileException { if (configDirectory == null) return; - File directory = new File(configDirectory + "\\dsmmusic"); + File directory = new File(configDirectory + "/dsmmusic"); if (!directory.exists()) directory.mkdir(); reset(); dungeonboss = AudioSystem.getClip(); - File dungeonBossFile = new File(configDirectory + "\\dsmmusic\\dungeonboss.wav"); + File dungeonBossFile = new File(configDirectory + "/dsmmusic/dungeonboss.wav"); + System.out.println("dungeonboss.wav exists?: " + dungeonBossFile.exists()); if (dungeonBossFile.exists()) { AudioInputStream ais = AudioSystem.getAudioInputStream(dungeonBossFile); dungeonboss.open(ais); -- cgit From 3c0abbe3008986e7b47d1656f96ea494528a3c87 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 23 Mar 2021 09:54:02 -0400 Subject: Add command to change custom music volume In decibels only --- README.md | 2 +- src/main/java/me/Danker/DankersSkyblockMod.java | 6 ++-- .../me/Danker/commands/CustomMusicCommand.java | 38 ++++++++++++++++++++-- src/main/java/me/Danker/features/CustomMusic.java | 3 +- .../java/me/Danker/handlers/ConfigHandler.java | 1 + 5 files changed, 43 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index a2f0227..f6c76e6 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Discord Server: https://discord.gg/QsEkNQS - /reparty - Disbands and reparties all members in the party - /fairysouls - Check the fairysouls of a player - /lobbybank - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank (and purse). -- /dsmmusic - Stops or reloads the custom music. +- /dsmmusic [dungeonboss] [#] - Stops or reloads the custom music. ## Keybinds - Open Maddox menu - M by default. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 4b453ea..84cd9cc 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -85,7 +85,7 @@ public class DankersSkyblockMod { public static String ANSWER_COLOUR; @EventHandler - public void init(FMLInitializationEvent event) { + public void init(FMLInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new ArachneESP()); MinecraftForge.EVENT_BUS.register(new ArrowTerminalSolver()); @@ -141,6 +141,7 @@ public class DankersSkyblockMod { ConfigHandler.reloadConfig(); GoldenEnchants.init(); TriviaSolver.init(); + CustomMusic.init(configDirectory); 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"); @@ -152,7 +153,7 @@ public class DankersSkyblockMod { } @EventHandler - public void preInit(final FMLPreInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { + public void preInit(final FMLPreInitializationEvent event) { ClientCommandHandler.instance.registerCommand(new ArmourCommand()); ClientCommandHandler.instance.registerCommand(new BankCommand()); ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); @@ -181,7 +182,6 @@ public class DankersSkyblockMod { ClientCommandHandler.instance.registerCommand(new ToggleCommand()); configDirectory = event.getModConfigurationDirectory().toString(); - CustomMusic.init(configDirectory); } @EventHandler diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java index 0279ee8..8e389ac 100644 --- a/src/main/java/me/Danker/commands/CustomMusicCommand.java +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -2,6 +2,7 @@ package me.Danker.commands; import me.Danker.DankersSkyblockMod; import me.Danker.features.CustomMusic; +import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -9,6 +10,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import javax.sound.sampled.Clip; +import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import java.io.IOException; @@ -23,7 +26,7 @@ public class CustomMusicCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " [dungeonboss] [#]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +41,9 @@ public class CustomMusicCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "stop", "reload"); + return getListOfStringsMatchingLastWord(args, "stop", "reload", "volume"); + } else if (args.length == 2) { + return getListOfStringsMatchingLastWord(args, "dungeonboss"); } return null; } @@ -66,6 +71,35 @@ public class CustomMusicCommand extends CommandBase { e.printStackTrace(); } break; + case "volume": + if (arg1.length < 3) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + return; + } + + switch (arg1[1].toLowerCase()) { + case "dungeonboss": + try { + float volume = Float.parseFloat(arg1[2]); + + FloatControl bounds = (FloatControl) CustomMusic.dungeonboss.getControl(FloatControl.Type.MASTER_GAIN); + if (volume <= bounds.getMinimum() || volume >= bounds.getMaximum()) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between " + bounds.getMinimum() + " and " + bounds.getMaximum() + ".")); + return; + } + + CustomMusic.dungeonbossDecibels = volume; + ConfigHandler.writeIntConfig("music", "DungeonBossDecibels", (int) volume); + CustomMusic.init(DankersSkyblockMod.configDirectory); + } catch (IOException | LineUnavailableException | UnsupportedAudioFileException e) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error occurred while trying to reload music.")); + e.printStackTrace(); + } + break; + default: + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + } + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 3c411d8..ee0a2cc 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -25,6 +25,7 @@ public class CustomMusic { static boolean prevInDungeonBossRoom = false; static boolean inDungeonBossRoom = false; public static Clip dungeonboss; + public static float dungeonbossDecibels; @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -98,7 +99,7 @@ public class CustomMusic { dungeonboss.open(ais); FloatControl volume = (FloatControl) dungeonboss.getControl(FloatControl.Type.MASTER_GAIN); - volume.setValue(-20F); + volume.setValue(dungeonbossDecibels); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 89eed6c..8a95ae5 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -274,6 +274,7 @@ public class ConfigHandler { ToggleCommand.hideTooltipsInExperimentAddonsToggled = initBoolean("toggles", "HideTooltipsInExperimentAddons", false); // Custom Music ToggleCommand.dungeonBossMusic = initBoolean("toggles", "DungeonBossMusic", false); + CustomMusic.dungeonbossDecibels = (float) initInt("music", "DungeonBossDecibels", -20); // API if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); -- cgit From e499665f275c324bcbf4c3c78b6ef40c20ba611b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 24 Mar 2021 14:59:29 -0400 Subject: Add dungeon and blood room custom music --- README.md | 8 +- src/main/java/me/Danker/DankersSkyblockMod.java | 3 + .../me/Danker/commands/CustomMusicCommand.java | 53 ++++++---- .../java/me/Danker/commands/DankerGuiCommand.java | 2 + .../java/me/Danker/commands/LobbyBankCommand.java | 1 - .../java/me/Danker/commands/ToggleCommand.java | 34 +++++-- src/main/java/me/Danker/features/ArachneESP.java | 10 -- src/main/java/me/Danker/features/CustomMusic.java | 111 ++++++++++++++++----- src/main/java/me/Danker/features/SlayerESP.java | 1 - src/main/java/me/Danker/gui/CustomMusicGui.java | 73 ++++++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 35 ++----- src/main/java/me/Danker/gui/OnlySlayerGui.java | 1 - .../java/me/Danker/handlers/ConfigHandler.java | 5 + 13 files changed, 239 insertions(+), 98 deletions(-) create mode 100644 src/main/java/me/Danker/gui/CustomMusicGui.java (limited to 'README.md') diff --git a/README.md b/README.md index f6c76e6..0bd7c27 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Discord Server: https://discord.gg/QsEkNQS - Watcher ready message - Catacombs F7 Stage 3 solvers (Starts with letter, select all colour, ignore arrows on sea lanterns) - Find correct Livid (with graphic display of HP) -- Use custom music in dungeon boss room +- Use custom music in supported locations - Experimentation solvers (Ultrasequencer, Chronomatron, Superpairs) - Hide tooltips in experiment addons - Hide tooltips in Melody's Harp @@ -85,7 +85,7 @@ Discord Server: https://discord.gg/QsEkNQS - /reparty - Disbands and reparties all members in the party - /fairysouls - Check the fairysouls of a player - /lobbybank - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank (and purse). -- /dsmmusic [dungeonboss] [#] - Stops or reloads the custom music. +- /dsmmusic [dungeonboss/bloodroom/dungeon] [#] - Stops, reloads or changes the volume of custom music. ## Keybinds - Open Maddox menu - M by default. @@ -93,7 +93,9 @@ Discord Server: https://discord.gg/QsEkNQS - Start/Stop Skill Tracker - Numpad 5 by default. ## Custom Music -- To use custom music, place a music file with the given name in the `.minecraft/config/dsmmusic` folder and enable the custom song in /dsm. +- To use custom music, place a music file with the given name in the `.minecraft/config/dsmmusic` folder, either run `/dsmmusic reload` or restart your game, and enable the custom song in `/dsm`. + - Dungeon music: `dungeon.wav` + - Blood room music: `bloodroom.wav` - Dungeon boss music: `dungeonboss.wav` ### Notes diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 0e7000b..17def9a 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -340,6 +340,9 @@ public class DankersSkyblockMod { case "skilltracker": mc.displayGuiScreen(new SkillTrackerGui()); break; + case "custommusic": + mc.displayGuiScreen(new CustomMusicGui()); + break; } } guiToOpen = null; diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java index 8e389ac..6412474 100644 --- a/src/main/java/me/Danker/commands/CustomMusicCommand.java +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -10,8 +10,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; -import javax.sound.sampled.Clip; -import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import java.io.IOException; @@ -26,7 +24,7 @@ public class CustomMusicCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [dungeonboss] [#]"; + return "/" + getCommandName() + " [dungeonboss/bloodroom/dungeon] [#]"; } public static String usage(ICommandSender arg0) { @@ -43,7 +41,7 @@ public class CustomMusicCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "stop", "reload", "volume"); } else if (args.length == 2) { - return getListOfStringsMatchingLastWord(args, "dungeonboss"); + return getListOfStringsMatchingLastWord(args, "dungeonboss", "bloodroom", "dungeon"); } return null; } @@ -59,7 +57,7 @@ public class CustomMusicCommand extends CommandBase { switch (arg1[0].toLowerCase()) { case "stop": - if (CustomMusic.dungeonboss != null) CustomMusic.dungeonboss.stop(); + CustomMusic.reset(); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Stopped custom music.")); break; case "reload": @@ -77,28 +75,43 @@ public class CustomMusicCommand extends CommandBase { return; } + float volume = Float.parseFloat(arg1[2]); + boolean success; + switch (arg1[1].toLowerCase()) { case "dungeonboss": - try { - float volume = Float.parseFloat(arg1[2]); - - FloatControl bounds = (FloatControl) CustomMusic.dungeonboss.getControl(FloatControl.Type.MASTER_GAIN); - if (volume <= bounds.getMinimum() || volume >= bounds.getMaximum()) { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between " + bounds.getMinimum() + " and " + bounds.getMaximum() + ".")); - return; - } - - CustomMusic.dungeonbossDecibels = volume; - ConfigHandler.writeIntConfig("music", "DungeonBossDecibels", (int) volume); - CustomMusic.init(DankersSkyblockMod.configDirectory); - } catch (IOException | LineUnavailableException | UnsupportedAudioFileException e) { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error occurred while trying to reload music.")); - e.printStackTrace(); + success = CustomMusic.dungeonboss.setVolume(volume); + if (!success) { + return; } + + CustomMusic.dungeonbossDecibels = volume; + ConfigHandler.writeIntConfig("music", "DungeonBossDecibels", (int) volume); + break; + case "bloodroom": + success = CustomMusic.bloodroom.setVolume(volume); + if (!success) { + return; + } + + CustomMusic.bloodroomDecibels = volume; + ConfigHandler.writeIntConfig("music", "BloodRoomDecibels", (int) volume); + break; + case "dungeon": + success = CustomMusic.dungeon.setVolume(volume); + if (!success) { + return; + } + + CustomMusic.dungeonDecibels = volume; + ConfigHandler.writeIntConfig("music", "DungeonDecibels", (int) volume); break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + return; } + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + DankersSkyblockMod.MAIN_COLOUR + " was set to " + DankersSkyblockMod.SECONDARY_COLOUR + volume + "db")); break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 97af0df..40fcb0a 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -97,6 +97,8 @@ public class DankerGuiCommand extends CommandBase { debug.append("[specialhoe][").append(ToggleCommand.specialHoeRightClick).append("]\n"); debug.append("[melodyTooltips][").append(ToggleCommand.melodyTooltips).append("]\n"); debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); + debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n"); + debug.append("[dungeonmusic][").append(ToggleCommand.dungeonMusic).append("]\n"); debug.append("# Locations\n"); debug.append("[coords][").append(MoveCommand.coordsXY[0]).append(", ").append(MoveCommand.coordsXY[1]).append("]\n"); debug.append("[display][").append(MoveCommand.displayXY[0]).append(", ").append(MoveCommand.displayXY[1]).append("]\n"); diff --git a/src/main/java/me/Danker/commands/LobbyBankCommand.java b/src/main/java/me/Danker/commands/LobbyBankCommand.java index 77dce2a..886077c 100644 --- a/src/main/java/me/Danker/commands/LobbyBankCommand.java +++ b/src/main/java/me/Danker/commands/LobbyBankCommand.java @@ -5,7 +5,6 @@ import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.command.CommandBase; diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index b8b5845..73011ad 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -80,6 +80,8 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean melodyTooltips; // Custom Music public static boolean dungeonBossMusic; + public static boolean bloodRoomMusic; + public static boolean dungeonMusic; @Override public String getCommandName() { @@ -96,8 +98,9 @@ public class ToggleCommand extends CommandBase implements ICommand { "notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/" + "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/icewalkpuzzle/watchermessage/" + "startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" + - "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/ " + - "/specialhoe/melodytooltips/highlightslayers/highlightArachne/dungeonbossmusic/list>"; + "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" + + "specialhoe/melodytooltips/highlightslayers/highlightarachne/dungeonbossmusic/bloodroommusic/" + + "dungeonmusic/list>"; } public static String usage(ICommandSender arg0) { @@ -124,7 +127,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "silverfishpuzzle", "icewalkpuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", - "hidetooltipsinaddons", "pickblock", "specialhoe", "melodytooltips", "highlightslayers", "dungeonbossmusic", "list"); + "hidetooltipsinaddons", "pickblock", "specialhoe", "melodytooltips", "highlightslayers", + "dungeonbossmusic", "bloodroommusic", "dungeonmusic", "list"); } return null; } @@ -436,16 +440,22 @@ public class ToggleCommand extends CommandBase implements ICommand { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Arachne " + DankersSkyblockMod.SECONDARY_COLOUR + highlightArachne + DankersSkyblockMod.MAIN_COLOUR + ".")); case "dungeonbossmusic": dungeonBossMusic = !dungeonBossMusic; - if (CustomMusic.dungeonboss != null) { - if (dungeonBossMusic) { - CustomMusic.start(); - } else { - CustomMusic.dungeonboss.stop(); - } - } + CustomMusic.dungeonboss.stop(); ConfigHandler.writeBooleanConfig("toggles", "DungeonBossMusic", dungeonBossMusic); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom dungeon boss music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonBossMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "bloodroommusic": + bloodRoomMusic = !bloodRoomMusic; + CustomMusic.bloodroom.stop(); + ConfigHandler.writeBooleanConfig("toggles", "BloodRoomMusic", bloodRoomMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom blood room music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + bloodRoomMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "dungeonmusic": + dungeonMusic = !dungeonMusic; + CustomMusic.dungeon.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DungeonMusic", dungeonMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom dungeon music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + @@ -496,7 +506,9 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in Melody's Harp " + DankersSkyblockMod.VALUE_COLOUR + melodyTooltips + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Highlight Slayer Bosses " + DankersSkyblockMod.VALUE_COLOUR + highlightSlayers + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Highlight Arachne Boss " + DankersSkyblockMod.VALUE_COLOUR + highlightArachne + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom blood room music: " + DankersSkyblockMod.VALUE_COLOUR + bloodRoomMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonMusic )); break; default: diff --git a/src/main/java/me/Danker/features/ArachneESP.java b/src/main/java/me/Danker/features/ArachneESP.java index 1a9b0b2..491c42a 100644 --- a/src/main/java/me/Danker/features/ArachneESP.java +++ b/src/main/java/me/Danker/features/ArachneESP.java @@ -1,27 +1,17 @@ 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.entity.Entity; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.passive.EntityWolf; 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.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.event.entity.player.AttackEntityEvent; -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.List; diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index ee0a2cc..342913f 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -6,6 +6,8 @@ import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.StringUtils; import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -22,10 +24,15 @@ import java.util.List; public class CustomMusic { + static boolean cancelNotes; static boolean prevInDungeonBossRoom = false; - static boolean inDungeonBossRoom = false; - public static Clip dungeonboss; + public static boolean inDungeonBossRoom = false; + public static Song dungeonboss; public static float dungeonbossDecibels; + public static Song bloodroom; + public static float bloodroomDecibels; + public static Song dungeon; + public static float dungeonDecibels; @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -56,30 +63,44 @@ public class CustomMusic { firstLine.contains("necron")) { // F7 inDungeonBossRoom = true; - if (!prevInDungeonBossRoom && dungeonboss != null) { - start(); + if (!prevInDungeonBossRoom) { + dungeonboss.start(); } } else { - reset(); + inDungeonBossRoom = false; + dungeonboss.stop(); } } } } } - @SubscribeEvent + @SubscribeEvent(receiveCanceled = true) public void onChat(ClientChatReceivedEvent event) { - if (!Utils.inDungeons) return; String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - if (message.contains("EXTRA STATS ")) { - if (dungeonboss != null) dungeonboss.stop(); + if (ToggleCommand.dungeonMusic && Utils.inDungeons) { + if (message.contains("[NPC] Mort: Here, I found this map when I first entered the dungeon.")) { + dungeon.start(); + } + } + + if (message.contains(":")) return; + + if (Utils.inDungeons) { + if (message.contains("EXTRA STATS ")) { + dungeonboss.stop(); + bloodroom.stop(); + dungeon.stop(); + } else if (ToggleCommand.bloodRoomMusic && message.contains("The BLOOD DOOR has been opened!")) { + bloodroom.start(); + } } } @SubscribeEvent public void onSound(PlaySoundEvent event) { - if (ToggleCommand.dungeonBossMusic && Utils.inDungeons && inDungeonBossRoom) { + if (cancelNotes) { if (event.isCancelable() && event.name.startsWith("note.")) event.setCanceled(true); } } @@ -91,29 +112,69 @@ public class CustomMusic { reset(); - dungeonboss = AudioSystem.getClip(); - File dungeonBossFile = new File(configDirectory + "/dsmmusic/dungeonboss.wav"); + File dungeonBossFile = new File(directory + "/dungeonboss.wav"); System.out.println("dungeonboss.wav exists?: " + dungeonBossFile.exists()); - if (dungeonBossFile.exists()) { - AudioInputStream ais = AudioSystem.getAudioInputStream(dungeonBossFile); - dungeonboss.open(ais); + dungeonboss = new Song(dungeonBossFile, dungeonbossDecibels); - FloatControl volume = (FloatControl) dungeonboss.getControl(FloatControl.Type.MASTER_GAIN); - volume.setValue(dungeonbossDecibels); - } + File bloodRoomFile = new File(directory + "/bloodroom.wav"); + System.out.println("bloodroom.wav exists?: " + bloodRoomFile.exists()); + bloodroom = new Song(bloodRoomFile, bloodroomDecibels); + + File dungeonFile = new File(directory + "/dungeon.wav"); + System.out.println("dungeon.wav exists?: " + dungeonFile.exists()); + dungeon = new Song(dungeonFile, dungeonDecibels); } - static void reset() { - inDungeonBossRoom = false; + public static void reset() { + cancelNotes = false; if (dungeonboss != null) dungeonboss.stop(); + if (bloodroom != null) bloodroom.stop(); + if (dungeon != null) dungeon.stop(); } - public static void start() { - if (dungeonboss != null && inDungeonBossRoom) { - dungeonboss.setMicrosecondPosition(0); - dungeonboss.start(); - dungeonboss.loop(Clip.LOOP_CONTINUOUSLY); + public static class Song { + + public Clip music; + + public Song(File file, float decibels) throws IOException, UnsupportedAudioFileException, LineUnavailableException { + if (file.exists()) { + music = AudioSystem.getClip(); + AudioInputStream ais = AudioSystem.getAudioInputStream(file); + music.open(ais); + + setVolume(decibels); + } } + + public void start() { + reset(); + cancelNotes = true; + if (music != null) { + music.setMicrosecondPosition(0); + music.start(); + music.loop(Clip.LOOP_CONTINUOUSLY); + } + } + + public void stop() { + cancelNotes = false; + if (music != null) music.stop(); + } + + public boolean setVolume(float decibels) { + if (music == null) return false; + + FloatControl control = (FloatControl) music.getControl(FloatControl.Type.MASTER_GAIN); + if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (player != null) player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between " + control.getMinimum() + " and " + control.getMaximum() + ".")); + return false; + } + + control.setValue(decibels); + return true; + } + } } diff --git a/src/main/java/me/Danker/features/SlayerESP.java b/src/main/java/me/Danker/features/SlayerESP.java index 17a1c0e..51537ba 100644 --- a/src/main/java/me/Danker/features/SlayerESP.java +++ b/src/main/java/me/Danker/features/SlayerESP.java @@ -11,7 +11,6 @@ import net.minecraft.util.StringUtils; import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/me/Danker/gui/CustomMusicGui.java b/src/main/java/me/Danker/gui/CustomMusicGui.java new file mode 100644 index 0000000..505bf34 --- /dev/null +++ b/src/main/java/me/Danker/gui/CustomMusicGui.java @@ -0,0 +1,73 @@ +package me.Danker.gui; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.features.CustomMusic; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class CustomMusicGui extends GuiScreen { + + private GuiButton goBack; + + private GuiButton dungeonBossMusic; + private GuiButton bloodRoomMusic; + private GuiButton dungeonMusic; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + dungeonMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Custom Dungeon Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonMusic)); + bloodRoomMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Custom Blood Room Music: " + Utils.getColouredBoolean(ToggleCommand.bloodRoomMusic)); + dungeonBossMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic)); + + this.buttonList.add(dungeonMusic); + this.buttonList.add(bloodRoomMusic); + this.buttonList.add(dungeonBossMusic); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == goBack) { + DankersSkyblockMod.guiToOpen = "dankergui1"; + } else if (button == dungeonBossMusic) { + ToggleCommand.dungeonBossMusic = !ToggleCommand.dungeonBossMusic; + CustomMusic.dungeonboss.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DungeonBossMusic", ToggleCommand.dungeonBossMusic); + dungeonBossMusic.displayString = "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic); + } else if (button == bloodRoomMusic) { + ToggleCommand.bloodRoomMusic = !ToggleCommand.bloodRoomMusic; + CustomMusic.bloodroom.stop(); + ConfigHandler.writeBooleanConfig("toggles", "BloodRoomMusic", ToggleCommand.bloodRoomMusic); + bloodRoomMusic.displayString = "Custom Blood Room Music: " + Utils.getColouredBoolean(ToggleCommand.bloodRoomMusic); + } else if (button == dungeonMusic) { + ToggleCommand.dungeonMusic = !ToggleCommand.dungeonMusic; + CustomMusic.dungeon.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DungeonMusic", ToggleCommand.dungeonMusic); + dungeonMusic.displayString = "Custom Dungeon Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonMusic); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 307882f..796be2b 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -2,7 +2,6 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; -import me.Danker.features.CustomMusic; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; @@ -40,7 +39,7 @@ public class DankerGui extends GuiScreen { private GuiButton puzzleSolvers; private GuiButton experimentationTableSolvers; private GuiButton skillTracker; - private GuiButton highlightArachne; + private GuiButton customMusic; // Toggles private GuiButton gparty; private GuiButton coords; @@ -57,10 +56,13 @@ public class DankerGui extends GuiScreen { private GuiButton skill50Display; private GuiButton outlineText; private GuiButton cakeTimer; + private GuiButton pickBlock; + private GuiButton notifySlayerSlain; private GuiButton shadowFury; private GuiButton specialHoe; private GuiButton melodyTooltips; - private GuiButton dungeonBossMusic; + private GuiButton autoSkillTracker; + private GuiButton highlightArachne; // Chat Messages private GuiButton lividDagger; private GuiButton sceptreMessages; @@ -77,11 +79,8 @@ public class DankerGui extends GuiScreen { private GuiButton stopSalvageStarred; private GuiButton watcherReadyMessage; private GuiButton flowerWeapons; - private GuiButton pickBlock; - private GuiButton notifySlayerSlain; private GuiButton necronNotifications; private GuiButton bonzoTimer; - private GuiButton autoSkillTracker; public DankerGui(int page, String searchText) { this.page = page; @@ -110,15 +109,14 @@ public class DankerGui extends GuiScreen { editLocations = new GuiButton(0, 2, 5, 100, 20, "Edit Locations"); search = new GuiTextField(0, this.fontRendererObj, width - 202, 5, 200, 20); - // Page 1 changeDisplay = new GuiButton(0, 0, 0, "Change Display Settings"); onlySlayer = new GuiButton(0, 0, 0, "Set Slayer Quest"); puzzleSolvers = new GuiButton(0, 0, 0, "Toggle Dungeons Puzzle Solvers"); experimentationTableSolvers = new GuiButton(0, 0, 0, "Toggle Experimentation Table Solvers"); skillTracker = new GuiButton(0, 0, 0, "Toggle Skill XP/Hour Tracking"); + customMusic = new GuiButton(0, 0, 0, "Custom Music"); outlineText = new GuiButton(0, 0, 0, "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); pickBlock = new GuiButton(0, 0, 0, "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockToggled)); - // Page 2 coords = new GuiButton(0, 0, 0, "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); chatMaddox = new GuiButton(0, 0, 0, "Click On-Screen to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled)); cakeTimer = new GuiButton(0, 0, 0, "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); @@ -126,7 +124,6 @@ public class DankerGui extends GuiScreen { slayerCount = new GuiButton(0, 0, 0, "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); aotd = new GuiButton(0, 0, 0, "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); lividDagger = new GuiButton(0, 0, 0, "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); - // Page 3 spiritBearAlert = new GuiButton(0, 0, 0, "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); sceptreMessages = new GuiButton(0, 0, 0, "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); midasStaffMessages = new GuiButton(0, 0, 0, "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); @@ -134,7 +131,6 @@ public class DankerGui extends GuiScreen { healMessages = new GuiButton(0, 0, 0, "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); cooldownMessages = new GuiButton(0, 0, 0, "Cooldown Messages: " + Utils.getColouredBoolean(ToggleCommand.cooldownMessages)); manaMessages = new GuiButton(0, 0, 0, "Mana Messages: " + Utils.getColouredBoolean(ToggleCommand.manaMessages)); - // Page 4 killComboMessages = new GuiButton(0, 0, 0, "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages)); goldenEnch = new GuiButton(0, 0, 0, "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); petColours = new GuiButton(0, 0, 0, "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); @@ -142,7 +138,6 @@ public class DankerGui extends GuiScreen { gparty = new GuiButton(0, 0, 0, "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); golemAlerts = new GuiButton(0, 0, 0, "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); rngesusAlert = new GuiButton(0, 0, 0, "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); - // Page 5 splitFishing = new GuiButton(0, 0, 0, "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); lowHealthNotify = new GuiButton(0, 0, 0, "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); lividSolver = new GuiButton(0, 0, 0, "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); @@ -150,15 +145,12 @@ public class DankerGui extends GuiScreen { stopSalvageStarred = new GuiButton(0, 0, 0, "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); watcherReadyMessage = new GuiButton(0, 0, 0, "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); flowerWeapons = new GuiButton(0, 0, 0, "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); - // Page 6 notifySlayerSlain = new GuiButton(0, 0, 0, "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); necronNotifications = new GuiButton(0, 0, 0, "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); bonzoTimer = new GuiButton(0, 0, 0, "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); autoSkillTracker = new GuiButton(0, 0, 0, "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); - dungeonBossMusic = new GuiButton(0, 0, 0, "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic)); shadowFury = new GuiButton(0, 0, 0, "Block Shadow Fury ability: " + Utils.getColouredBoolean(ToggleCommand.shadowFuryToggled)); specialHoe = new GuiButton(0, 0, 0, "Block Special Hoe right click: " + Utils.getColouredBoolean(ToggleCommand.specialHoeRightClick)); - // Page 7 melodyTooltips = new GuiButton(0, 0, 0, "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips)); highlightArachne = new GuiButton(0, 0, 0, "Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne)); @@ -167,6 +159,7 @@ public class DankerGui extends GuiScreen { allButtons.add(puzzleSolvers); allButtons.add(experimentationTableSolvers); allButtons.add(skillTracker); + allButtons.add(customMusic); allButtons.add(outlineText); allButtons.add(pickBlock); allButtons.add(coords); @@ -201,7 +194,6 @@ public class DankerGui extends GuiScreen { allButtons.add(necronNotifications); allButtons.add(bonzoTimer); allButtons.add(autoSkillTracker); - allButtons.add(dungeonBossMusic); allButtons.add(shadowFury); allButtons.add(specialHoe); allButtons.add(melodyTooltips); @@ -289,6 +281,8 @@ public class DankerGui extends GuiScreen { DankersSkyblockMod.guiToOpen = "experimentsolvers"; } else if (button == skillTracker) { DankersSkyblockMod.guiToOpen = "skilltracker"; + } else if (button == customMusic) { + DankersSkyblockMod.guiToOpen = "custommusic"; } else if (button == outlineText) { ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); @@ -441,17 +435,6 @@ public class DankerGui extends GuiScreen { ToggleCommand.highlightArachne = !ToggleCommand.highlightArachne; ConfigHandler.writeBooleanConfig("toggles", "HighlightArachne", ToggleCommand.highlightArachne); highlightArachne.displayString = "Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne); - } else if (button == dungeonBossMusic) { - ToggleCommand.dungeonBossMusic = !ToggleCommand.dungeonBossMusic; - if (CustomMusic.dungeonboss != null) { - if (ToggleCommand.dungeonBossMusic) { - CustomMusic.start(); - } else { - CustomMusic.dungeonboss.stop(); - } - } - ConfigHandler.writeBooleanConfig("toggles", "DungeonBossMusic", ToggleCommand.dungeonBossMusic); - dungeonBossMusic.displayString = "Custom Dungeon Boss Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonBossMusic); } } diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index 762e5e5..ec26a13 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -7,7 +7,6 @@ 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.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 8a95ae5..6d474d4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -274,7 +274,12 @@ public class ConfigHandler { ToggleCommand.hideTooltipsInExperimentAddonsToggled = initBoolean("toggles", "HideTooltipsInExperimentAddons", false); // Custom Music ToggleCommand.dungeonBossMusic = initBoolean("toggles", "DungeonBossMusic", false); + ToggleCommand.bloodRoomMusic = initBoolean("toggles", "BloodRoomMusic", false); + ToggleCommand.dungeonMusic = initBoolean("toggles", "DungeonMusic", false); + // Music Volume CustomMusic.dungeonbossDecibels = (float) initInt("music", "DungeonBossDecibels", -20); + CustomMusic.bloodroomDecibels = (float) initInt("music", "BloodRoomDecibels", -20); + CustomMusic.dungeonDecibels = (float) initInt("music", "DungeonDecibels", -20); // API if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); -- cgit From 57e5469f651610a4f07bf8e5266b789d7ca1fe34 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 28 Mar 2021 17:46:45 -0400 Subject: Change /dsmmusic volume to percentage from decibels Also fix custom music not cancelling note block music --- README.md | 7 +++-- build.gradle | 2 +- src/main/java/me/Danker/DankersSkyblockMod.java | 2 +- .../me/Danker/commands/CustomMusicCommand.java | 18 +++++------ src/main/java/me/Danker/features/CustomMusic.java | 36 +++++++++++----------- .../java/me/Danker/handlers/ConfigHandler.java | 6 ++-- 6 files changed, 37 insertions(+), 34 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0bd7c27..f42b153 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Discord Server: https://discord.gg/QsEkNQS - /reparty - Disbands and reparties all members in the party - /fairysouls - Check the fairysouls of a player - /lobbybank - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank (and purse). -- /dsmmusic [dungeonboss/bloodroom/dungeon] [#] - Stops, reloads or changes the volume of custom music. +- /dsmmusic [dungeonboss/bloodroom/dungeon] [1-100] - Stops, reloads or changes the volume of custom music. ## Keybinds - Open Maddox menu - M by default. @@ -93,10 +93,13 @@ Discord Server: https://discord.gg/QsEkNQS - Start/Stop Skill Tracker - Numpad 5 by default. ## Custom Music -- To use custom music, place a music file with the given name in the `.minecraft/config/dsmmusic` folder, either run `/dsmmusic reload` or restart your game, and enable the custom song in `/dsm`. +1. Place a music file with the given name in the `.mincraft/config/dsmmusic` folder: - Dungeon music: `dungeon.wav` - Blood room music: `bloodroom.wav` - Dungeon boss music: `dungeonboss.wav` +2. Either run `/dsmmusic reload` or restart your game. +3. Enable the custom music in `/dsm`. +4. (Optional) Change the volume of the music with `/dsmmusic volume`. ### Notes - Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker. diff --git a/build.gradle b/build.gradle index db9242c..bbbfa06 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.8.6-beta5" +version = "1.8.6-beta6" group= "me.Danker.DankersSkyblockMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 17def9a..0d6dbac 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -62,7 +62,7 @@ import java.util.Map; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.6-beta5"; + public static final String VERSION = "1.8.6-beta6"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java index 6412474..0e80dd3 100644 --- a/src/main/java/me/Danker/commands/CustomMusicCommand.java +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -24,7 +24,7 @@ public class CustomMusicCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [dungeonboss/bloodroom/dungeon] [#]"; + return "/" + getCommandName() + " [dungeonboss/bloodroom/dungeon] [1-100]"; } public static String usage(ICommandSender arg0) { @@ -75,7 +75,7 @@ public class CustomMusicCommand extends CommandBase { return; } - float volume = Float.parseFloat(arg1[2]); + int volume = Integer.parseInt(arg1[2]); boolean success; switch (arg1[1].toLowerCase()) { @@ -85,8 +85,8 @@ public class CustomMusicCommand extends CommandBase { return; } - CustomMusic.dungeonbossDecibels = volume; - ConfigHandler.writeIntConfig("music", "DungeonBossDecibels", (int) volume); + CustomMusic.dungeonbossVolume = volume; + ConfigHandler.writeIntConfig("music", "DungeonBossVolume", volume); break; case "bloodroom": success = CustomMusic.bloodroom.setVolume(volume); @@ -94,8 +94,8 @@ public class CustomMusicCommand extends CommandBase { return; } - CustomMusic.bloodroomDecibels = volume; - ConfigHandler.writeIntConfig("music", "BloodRoomDecibels", (int) volume); + CustomMusic.bloodroomVolume = volume; + ConfigHandler.writeIntConfig("music", "BloodRoomVolume", volume); break; case "dungeon": success = CustomMusic.dungeon.setVolume(volume); @@ -103,15 +103,15 @@ public class CustomMusicCommand extends CommandBase { return; } - CustomMusic.dungeonDecibels = volume; - ConfigHandler.writeIntConfig("music", "DungeonDecibels", (int) volume); + CustomMusic.dungeonVolume = volume; + ConfigHandler.writeIntConfig("music", "DungeonVolume", volume); break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + DankersSkyblockMod.MAIN_COLOUR + " was set to " + DankersSkyblockMod.SECONDARY_COLOUR + volume + "db")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + DankersSkyblockMod.MAIN_COLOUR + " was set to " + DankersSkyblockMod.SECONDARY_COLOUR + volume + "%")); break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 342913f..4b1f6bb 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -28,11 +28,11 @@ public class CustomMusic { static boolean prevInDungeonBossRoom = false; public static boolean inDungeonBossRoom = false; public static Song dungeonboss; - public static float dungeonbossDecibels; + public static int dungeonbossVolume; public static Song bloodroom; - public static float bloodroomDecibels; + public static int bloodroomVolume; public static Song dungeon; - public static float dungeonDecibels; + public static int dungeonVolume; @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -66,9 +66,6 @@ public class CustomMusic { if (!prevInDungeonBossRoom) { dungeonboss.start(); } - } else { - inDungeonBossRoom = false; - dungeonboss.stop(); } } } @@ -100,8 +97,8 @@ public class CustomMusic { @SubscribeEvent public void onSound(PlaySoundEvent event) { - if (cancelNotes) { - if (event.isCancelable() && event.name.startsWith("note.")) event.setCanceled(true); + if (cancelNotes && event.name.startsWith("note.")) { + event.result = null; } } @@ -114,19 +111,18 @@ public class CustomMusic { File dungeonBossFile = new File(directory + "/dungeonboss.wav"); System.out.println("dungeonboss.wav exists?: " + dungeonBossFile.exists()); - dungeonboss = new Song(dungeonBossFile, dungeonbossDecibels); + dungeonboss = new Song(dungeonBossFile, dungeonbossVolume); File bloodRoomFile = new File(directory + "/bloodroom.wav"); System.out.println("bloodroom.wav exists?: " + bloodRoomFile.exists()); - bloodroom = new Song(bloodRoomFile, bloodroomDecibels); + bloodroom = new Song(bloodRoomFile, bloodroomVolume); File dungeonFile = new File(directory + "/dungeon.wav"); System.out.println("dungeon.wav exists?: " + dungeonFile.exists()); - dungeon = new Song(dungeonFile, dungeonDecibels); + dungeon = new Song(dungeonFile, dungeonVolume); } public static void reset() { - cancelNotes = false; if (dungeonboss != null) dungeonboss.stop(); if (bloodroom != null) bloodroom.stop(); if (dungeon != null) dungeon.stop(); @@ -136,20 +132,20 @@ public class CustomMusic { public Clip music; - public Song(File file, float decibels) throws IOException, UnsupportedAudioFileException, LineUnavailableException { + public Song(File file, int volume) throws IOException, UnsupportedAudioFileException, LineUnavailableException { if (file.exists()) { music = AudioSystem.getClip(); AudioInputStream ais = AudioSystem.getAudioInputStream(file); music.open(ais); - setVolume(decibels); + setVolume(volume); } } public void start() { reset(); - cancelNotes = true; if (music != null) { + cancelNotes = true; music.setMicrosecondPosition(0); music.start(); music.loop(Clip.LOOP_CONTINUOUSLY); @@ -161,13 +157,17 @@ public class CustomMusic { if (music != null) music.stop(); } - public boolean setVolume(float decibels) { + public boolean setVolume(int volume) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (music == null) return false; + if (volume <= 0 || volume > 100) { + if (player != null) player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between 0% and 100%.")); + return false; + } + float decibels = (float) (20 * Math.log(volume / 100.0)); FloatControl control = (FloatControl) music.getControl(FloatControl.Type.MASTER_GAIN); if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player != null) player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between " + control.getMinimum() + " and " + control.getMaximum() + ".")); return false; } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 6d474d4..1551a3e 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -277,9 +277,9 @@ public class ConfigHandler { ToggleCommand.bloodRoomMusic = initBoolean("toggles", "BloodRoomMusic", false); ToggleCommand.dungeonMusic = initBoolean("toggles", "DungeonMusic", false); // Music Volume - CustomMusic.dungeonbossDecibels = (float) initInt("music", "DungeonBossDecibels", -20); - CustomMusic.bloodroomDecibels = (float) initInt("music", "BloodRoomDecibels", -20); - CustomMusic.dungeonDecibels = (float) initInt("music", "DungeonDecibels", -20); + CustomMusic.dungeonbossVolume = initInt("music", "DungeonBossVolume", 50); + CustomMusic.bloodroomVolume = initInt("music", "BloodRoomVolume", 50); + CustomMusic.dungeonVolume = initInt("music", "DungeonVolume", 50); // API if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); -- cgit From 032cbaea86a08b98a239257f464a00a925068fda Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 28 Mar 2021 19:22:35 -0400 Subject: Add 20s countdown to golem alert --- README.md | 6 ++-- src/main/java/me/Danker/commands/MoveCommand.java | 12 ++++++-- src/main/java/me/Danker/commands/ScaleCommand.java | 10 +++++-- .../me/Danker/features/GolemSpawningAlert.java | 32 +++++++++++++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 4 +-- src/main/java/me/Danker/gui/EditLocationsGui.java | 22 ++++++++++++-- .../java/me/Danker/handlers/ConfigHandler.java | 4 +++ src/main/resources/assets/dsm/icons/golem.png | Bin 0 -> 8454 bytes 8 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 src/main/resources/assets/dsm/icons/golem.png (limited to 'README.md') diff --git a/README.md b/README.md index f42b153..7c922cc 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Discord Server: https://discord.gg/QsEkNQS - Hide tooltips in experiment addons - Hide tooltips in Melody's Harp - Pet background colors based on level -- Golem spawning alerts +- Golem spawning alerts + 20 second timer - Skill xp/hour tracker - Show total skill xp instead of progress to next level - Show time until century cakes run out @@ -68,8 +68,8 @@ Discord Server: https://discord.gg/QsEkNQS - /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. +- /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/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 6dedbaf..6fe2939 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -22,6 +22,7 @@ public class MoveCommand extends CommandBase { public static int[] skillTrackerXY = {0, 0}; public static int[] waterAnswerXY = {0, 0}; public static int[] bonzoTimerXY = {0, 0}; + public static int[] golemTimerXY = {0 ,0}; @Override public String getCommandName() { @@ -30,7 +31,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } public static String usage(ICommandSender arg0) { @@ -45,7 +46,7 @@ public class MoveCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer"); } return null; } @@ -123,6 +124,13 @@ public class MoveCommand extends CommandBase { ConfigHandler.writeIntConfig("locations", "bonzoTimerX", bonzoTimerXY[1]); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Bonzo's Mask timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; + case "golemtimer": + golemTimerXY[0] = Integer.parseInt(arg1[1]); + golemTimerXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "golemTimerX", golemTimerXY[0]); + ConfigHandler.writeIntConfig("locations", "golemTimerY", golemTimerXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golem timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index 17fb60f..b27ac50 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -22,6 +22,7 @@ public class ScaleCommand extends CommandBase { public static double skillTrackerScale; public static double waterAnswerScale; public static double bonzoTimerScale; + public static double golemTimerScale; @Override public String getCommandName() { @@ -30,7 +31,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } public static String usage(ICommandSender arg0) { @@ -45,7 +46,7 @@ public class ScaleCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer"); } return null; } @@ -111,6 +112,11 @@ public class ScaleCommand extends CommandBase { ConfigHandler.writeDoubleConfig("scales", "bonzoTimerScale", bonzoTimerScale); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Bonzo's Mask timer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + bonzoTimerScale + "x")); break; + case "golemtimer": + golemTimerScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "golemTimerScale", golemTimerScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golem timer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + golemTimerScale + "x")); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/features/GolemSpawningAlert.java b/src/main/java/me/Danker/features/GolemSpawningAlert.java index 91b647e..de5cb89 100644 --- a/src/main/java/me/Danker/features/GolemSpawningAlert.java +++ b/src/main/java/me/Danker/features/GolemSpawningAlert.java @@ -1,14 +1,26 @@ 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.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 GolemSpawningAlert { + double golemTime = 0; + public static final ResourceLocation GOLEM_ICON = new ResourceLocation("dsm", "icons/golem.png"); + public static String GOLEM_COLOUR; + @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); @@ -18,9 +30,29 @@ public class GolemSpawningAlert { if (ToggleCommand.golemAlertToggled) { if (message.contains("The ground begins to shake as an Endstone Protector rises from below!")) { + golemTime = System.currentTimeMillis() / 1000 + 20; Utils.createTitle(EnumChatFormatting.RED + "GOLEM SPAWNING!", 3); } } } + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.golemAlertToggled && Utils.inSkyblock && golemTime > System.currentTimeMillis() / 1000) { + Minecraft mc = Minecraft.getMinecraft(); + double scale = ScaleCommand.golemTimerScale; + double scaleReset = Math.pow(scale, -1); + GL11.glScaled(scale, scale, scale); + + double timeNow = System.currentTimeMillis() / 1000; + mc.getTextureManager().bindTexture(GOLEM_ICON); + Gui.drawModalRectWithCustomSizedTexture(MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1], 0, 0, 16, 16, 16, 16); + + String golemText = GOLEM_COLOUR + Utils.getTimeBetween(timeNow, golemTime); + new TextRenderer(mc, golemText, MoveCommand.golemTimerXY[0] + 20, MoveCommand.golemTimerXY[1] + 5, 1); + + GL11.glScaled(scaleReset, scaleReset, scaleReset); + } + } + } diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 796be2b..d8100b5 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -136,7 +136,7 @@ public class DankerGui extends GuiScreen { petColours = new GuiButton(0, 0, 0, "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); expertiseLore = new GuiButton(0, 0, 0, "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); gparty = new GuiButton(0, 0, 0, "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); - golemAlerts = new GuiButton(0, 0, 0, "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + golemAlerts = new GuiButton(0, 0, 0, "Golem Spawn Alert And Timer: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); rngesusAlert = new GuiButton(0, 0, 0, "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); splitFishing = new GuiButton(0, 0, 0, "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); lowHealthNotify = new GuiButton(0, 0, 0, "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); @@ -326,7 +326,7 @@ public class DankerGui extends GuiScreen { } else if (button == golemAlerts) { ToggleCommand.golemAlertToggled = !ToggleCommand.golemAlertToggled; ConfigHandler.writeBooleanConfig("toggles", "GolemAlerts", ToggleCommand.golemAlertToggled); - golemAlerts.displayString = "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled); + golemAlerts.displayString = "Golem Spawn Alert And Timer: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled); } else if (button == expertiseLore) { ToggleCommand.expertiseLoreToggled = !ToggleCommand.expertiseLoreToggled; ConfigHandler.writeBooleanConfig("toggles", "ExpertiseLore", ToggleCommand.expertiseLoreToggled); diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index cefe0a3..3a7c94b 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -28,6 +28,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton skillTracker; private LocationButton waterAnswer; private LocationButton bonzoTimer; + private LocationButton golemTimer; @Override public boolean doesGuiPauseGame() { @@ -93,8 +94,8 @@ public class EditLocationsGui extends GuiScreen { cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, CakeTimer.CAKE_COLOUR + " 11h16m", null, null); skillTracker = new LocationButton(0, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], 150 * ScaleCommand.skillTrackerScale, 28 * ScaleCommand.skillTrackerScale, ScaleCommand.skillTrackerScale, skillTrackerText, null, null); waterAnswer = new LocationButton(0, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], 190 * ScaleCommand.waterAnswerScale, 54 * ScaleCommand.waterAnswerScale, ScaleCommand.waterAnswerScale, waterAnswerText, null, null); - bonzoTimer = new LocationButton(0, MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1] + 5, 85 * ScaleCommand.bonzoTimerScale, 18 * ScaleCommand.bonzoTimerScale, ScaleCommand.bonzoTimerScale, BonzoMaskTimer.BONZO_COLOR + " 3m30s", null, null); - + bonzoTimer = new LocationButton(0, MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1] + 5, 53 * ScaleCommand.bonzoTimerScale, 18 * ScaleCommand.bonzoTimerScale, ScaleCommand.bonzoTimerScale, BonzoMaskTimer.BONZO_COLOR + " 3m30s", null, null); + golemTimer = new LocationButton(0, MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1] + 5, 42 * ScaleCommand.golemTimerScale, 18 * ScaleCommand.golemTimerScale, ScaleCommand.golemTimerScale, GolemSpawningAlert.GOLEM_COLOUR + " 20s", null, null); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); @@ -105,6 +106,7 @@ public class EditLocationsGui extends GuiScreen { this.buttonList.add(bonzoTimer); this.buttonList.add(display); this.buttonList.add(skill50); + this.buttonList.add(golemTimer); } @Override @@ -126,6 +128,12 @@ public class EditLocationsGui extends GuiScreen { Gui.drawModalRectWithCustomSizedTexture(MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1], 0, 0, 16, 16, 16, 16); GL11.glScaled(bonzoTimerScaleReset, bonzoTimerScaleReset, bonzoTimerScaleReset); + double golemTimerScale = ScaleCommand.golemTimerScale; + double golemTimerScaleReset = Math.pow(golemTimerScale, -1); + GL11.glScaled(golemTimerScale, golemTimerScale, golemTimerScale); + mc.getTextureManager().bindTexture(GolemSpawningAlert.GOLEM_ICON); + Gui.drawModalRectWithCustomSizedTexture(MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1], 0, 0, 16, 16, 16, 16); + GL11.glScaled(golemTimerScaleReset, golemTimerScaleReset, golemTimerScaleReset); super.drawScreen(mouseX, mouseY, partialTicks); } @@ -190,6 +198,12 @@ public class EditLocationsGui extends GuiScreen { bonzoTimer.xPosition = MoveCommand.bonzoTimerXY[0]; bonzoTimer.yPosition = MoveCommand.bonzoTimerXY[1]; break; + case "golemTimer": + MoveCommand.golemTimerXY[0] += xMoved; + MoveCommand.golemTimerXY[1] += yMoved; + golemTimer.xPosition = MoveCommand.golemTimerXY[0]; + golemTimer.yPosition = MoveCommand.golemTimerXY[1]; + break; } this.buttonList.clear(); initGui(); @@ -220,6 +234,8 @@ public class EditLocationsGui extends GuiScreen { moving = "waterAnswer"; } else if (button == bonzoTimer) { moving = "bonzoTimer"; + } else if (button == golemTimer) { + moving = "golemTimer"; } } } @@ -246,6 +262,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "waterAnswerY", MoveCommand.waterAnswerXY[1]); ConfigHandler.writeIntConfig("locations", "bonzoTimerX", MoveCommand.bonzoTimerXY[0]); ConfigHandler.writeIntConfig("locations", "bonzoTimerY", MoveCommand.bonzoTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "golemTimerX", MoveCommand.golemTimerXY[0]); + ConfigHandler.writeIntConfig("locations", "golemTimerY", MoveCommand.golemTimerXY[1]); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 1551a3e..04f4ccd 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -490,6 +490,8 @@ public class ConfigHandler { MoveCommand.waterAnswerXY[1] = initInt("locations", "waterAnswerY", 100); MoveCommand.bonzoTimerXY[0] = initInt("locations", "bonzoTimerX", 40); MoveCommand.bonzoTimerXY[1] = initInt("locations", "bonzoTimerY", 80); + MoveCommand.golemTimerXY[0] = initInt("locations", "golemTimerX", 100); + MoveCommand.golemTimerXY[1] = initInt("locations", "golemTimerY", 30); // Scales ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); @@ -501,6 +503,7 @@ public class ConfigHandler { ScaleCommand.skillTrackerScale = initDouble("scales", "skillTrackerScale", 1); ScaleCommand.waterAnswerScale = initDouble("scales", "waterAnswerScale", 1); ScaleCommand.bonzoTimerScale = initDouble("scales", "bonzoTimerScale", 1); + ScaleCommand.golemTimerScale = initDouble("scales", "golemTimerScale", 1); // Colours DankersSkyblockMod.MAIN_COLOUR = initString("colors", "main", EnumChatFormatting.GREEN.toString()); @@ -517,6 +520,7 @@ public class ConfigHandler { 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()); + GolemSpawningAlert.GOLEM_COLOUR = initString("colors", "golemDisplay", EnumChatFormatting.GOLD.toString()); BlazeSolver.LOWEST_BLAZE_COLOUR = initInt("colors", "blazeLowest", 0xFF0000); BlazeSolver.HIGHEST_BLAZE_COLOUR = initInt("colors", "blazeHighest", 0x40FF40); SlayerESP.SLAYER_COLOUR = initInt("colors", "slayerColor", 0x0000FF); diff --git a/src/main/resources/assets/dsm/icons/golem.png b/src/main/resources/assets/dsm/icons/golem.png new file mode 100644 index 0000000..33a0c93 Binary files /dev/null and b/src/main/resources/assets/dsm/icons/golem.png differ -- cgit From df1f83cf4ddb80969d2086cf1d7a86df9dc90653 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 2 Apr 2021 17:26:21 -0400 Subject: Remove features Remove blocking starting wrong slayer quest Remove blocking using abilities Remove placing flower weapons Remove blocking misclicks in solvers Remove F7 arrow terminal solver --- README.md | 13 +- src/main/java/me/Danker/DankersSkyblockMod.java | 9 -- .../me/Danker/commands/BlockSlayerCommand.java | 105 ------------- src/main/java/me/Danker/commands/DHelpCommand.java | 1 - .../java/me/Danker/commands/DankerGuiCommand.java | 7 - .../java/me/Danker/commands/ToggleCommand.java | 65 ++------ .../java/me/Danker/features/BlockAbilities.java | 96 ------------ .../me/Danker/features/BlockPlacingFlowers.java | 44 ------ .../java/me/Danker/features/BlockWrongSlayer.java | 42 ------ .../puzzlesolvers/ArrowTerminalSolver.java | 32 ---- .../puzzlesolvers/BlockWrongTerminalClicks.java | 112 -------------- .../features/puzzlesolvers/ChronomatronSolver.java | 15 +- .../puzzlesolvers/UltrasequencerSolver.java | 25 ---- src/main/java/me/Danker/gui/DankerGui.java | 47 +----- src/main/java/me/Danker/gui/OnlySlayerGui.java | 165 --------------------- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 14 -- .../java/me/Danker/handlers/ConfigHandler.java | 15 -- .../java/me/Danker/handlers/PacketHandler.java | 31 ---- 18 files changed, 21 insertions(+), 817 deletions(-) delete mode 100644 src/main/java/me/Danker/commands/BlockSlayerCommand.java delete mode 100644 src/main/java/me/Danker/features/BlockAbilities.java delete mode 100644 src/main/java/me/Danker/features/BlockPlacingFlowers.java delete mode 100644 src/main/java/me/Danker/features/BlockWrongSlayer.java delete mode 100644 src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java delete mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java delete mode 100644 src/main/java/me/Danker/gui/OnlySlayerGui.java (limited to 'README.md') diff --git a/README.md b/README.md index 7c922cc..f5f9786 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,12 @@ Discord Server: https://discord.gg/QsEkNQS - Old Animations 2.6.4 - Pet colors does not color slots - Catacombs F7 terminal solvers do not color slots - - Ultrasequencer solver does not color slots + - Enchanting solvers do not color slots ## Current features - Guild party desktop notifications - Coordinate and angle display - Golden T10/T6/T4 enchant display -- Block AOTD ability -- Block Livid Dagger ability -- Block Shadow Fury ability -- Block right click with special hoes -- Block placing Flower of Truth/Spirit Sceptre - Disable Spirit Sceptre messages - Disable Midas Staff messages - Disable Implosion messages @@ -31,7 +26,6 @@ Discord Server: https://discord.gg/QsEkNQS - RNGesus drop alerts - 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 @@ -39,7 +33,7 @@ Discord Server: https://discord.gg/QsEkNQS - Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe, boulder, silverfish, ice walk) - 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) +- Catacombs F7 Stage 3 solvers (Starts with letter, select all colour) - Find correct Livid (with graphic display of HP) - Use custom music in supported locations - Experimentation solvers (Ultrasequencer, Chronomatron, Superpairs) @@ -62,7 +56,7 @@ 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/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. @@ -80,7 +74,6 @@ Discord Server: https://discord.gg/QsEkNQS - /dungeons [player] - Uses API to get dungeon levels of a person. If no name is provided, it checks yours. - /importfishing - Imports your fishing stats from your latest profile to your fishing tracker using the API. - /sbplayers - Uses API to find how many players are on each Skyblock island. -- /onlyslayer <1/2/3/4/5> - Stops you from starting a slayer quest other than the one specified. - /skilltracker - Text display for skill xp/hour. - /reparty - Disbands and reparties all members in the party - /fairysouls - Check the fairysouls of a player diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 0d6dbac..3aeb452 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -88,14 +88,9 @@ public class DankersSkyblockMod { public void init(FMLInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new ArachneESP()); - MinecraftForge.EVENT_BUS.register(new ArrowTerminalSolver()); MinecraftForge.EVENT_BUS.register(new AutoDisplay()); MinecraftForge.EVENT_BUS.register(new AutoSwapToPickBlock()); MinecraftForge.EVENT_BUS.register(new BlazeSolver()); - MinecraftForge.EVENT_BUS.register(new BlockAbilities()); - MinecraftForge.EVENT_BUS.register(new BlockPlacingFlowers()); - 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()); @@ -156,7 +151,6 @@ public class DankersSkyblockMod { public void preInit(final FMLPreInitializationEvent event) { ClientCommandHandler.instance.registerCommand(new ArmourCommand()); ClientCommandHandler.instance.registerCommand(new BankCommand()); - ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); ClientCommandHandler.instance.registerCommand(new CustomMusicCommand()); ClientCommandHandler.instance.registerCommand(new DHelpCommand()); ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); @@ -325,9 +319,6 @@ public class DankersSkyblockMod { case "displaygui": mc.displayGuiScreen(new DisplayGui()); break; - case "onlyslayergui": - mc.displayGuiScreen(new OnlySlayerGui()); - break; case "editlocations": mc.displayGuiScreen(new EditLocationsGui()); break; diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java deleted file mode 100644 index 06fb4ef..0000000 --- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java +++ /dev/null @@ -1,105 +0,0 @@ -package me.Danker.commands; - -import me.Danker.DankersSkyblockMod; -import me.Danker.features.BlockWrongSlayer; -import me.Danker.handlers.ConfigHandler; -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; - -import java.util.List; - -public class BlockSlayerCommand extends CommandBase { - - @Override - public String getCommandName() { - return "onlyslayer"; - } - - @Override - public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <1/2/3/4/5>"; - } - - public static String usage(ICommandSender arg0) { - return new BlockSlayerCommand().getCommandUsage(arg0); - } - - @Override - public int getRequiredPermissionLevel() { - return 0; - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf"); - } else if (args.length == 2) { - return getListOfStringsMatchingLastWord(args, "1", "2", "3", "4", "5"); - } - return null; - } - - @Override - public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { - final EntityPlayer player = (EntityPlayer)arg0; - - if (arg1.length == 0 || (arg1.length == 1 && !arg1[0].equalsIgnoreCase("off"))) { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - return; - } - - switch (arg1[0].toLowerCase()) { - case "zombie": - BlockWrongSlayer.onlySlayerName = "Revenant Horror"; - break; - case "spider": - BlockWrongSlayer.onlySlayerName = "Tarantula Broodfather"; - break; - case "wolf": - BlockWrongSlayer.onlySlayerName = "Sven Packmaster"; - break; - case "off": - BlockWrongSlayer.onlySlayerName = ""; - BlockWrongSlayer.onlySlayerNumber = ""; - ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Slayer blocking turned off.")); - return; - default: - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - return; - } - - int slayerNumber = Integer.parseInt(arg1[1]); - // Just manually set to roman numeral, I don't wanna put a whole converter in here - switch (slayerNumber) { - case 1: - BlockWrongSlayer.onlySlayerNumber = "I"; - break; - case 2: - BlockWrongSlayer.onlySlayerNumber = "II"; - break; - case 3: - BlockWrongSlayer.onlySlayerNumber = "III"; - break; - case 4: - BlockWrongSlayer.onlySlayerNumber = "IV"; - break; - case 5: - BlockWrongSlayer.onlySlayerNumber = "V"; - break; - default: - BlockWrongSlayer.onlySlayerName = ""; - BlockWrongSlayer.onlySlayerNumber = ""; - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - return; - } - - ConfigHandler.writeStringConfig("toggles", "BlockSlayer", BlockWrongSlayer.onlySlayerName + " " + BlockWrongSlayer.onlySlayerNumber); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Slayer blocking set to " + DankersSkyblockMod.SECONDARY_COLOUR + BlockWrongSlayer.onlySlayerName + " " + BlockWrongSlayer.onlySlayerNumber)); - } - -} diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index f6cfb82..8d47576 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -52,7 +52,6 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + DungeonsCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to get dungeon levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + ImportFishingCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" + EnumChatFormatting.GOLD + SkyblockPlayersCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + - EnumChatFormatting.GOLD + BlockSlayerCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + EnumChatFormatting.GOLD + SkillTrackerCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Text display for skill xp/hour.\n" + EnumChatFormatting.GOLD + LobbyBankCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank(and purse).\n" + EnumChatFormatting.GOLD + RepartyCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Disbands and reparties all members in the party.\n" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 40fcb0a..5076ef7 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -49,9 +49,6 @@ public class DankerGuiCommand extends CommandBase { debug.append("[splitfishing][").append(ToggleCommand.splitFishing).append("]\n"); debug.append("[chatmaddox][").append(ToggleCommand.chatMaddoxToggled).append("]\n"); debug.append("[spiritbearalerts][").append(ToggleCommand.spiritBearAlerts).append("]\n"); - debug.append("[aotd][").append(ToggleCommand.aotdToggled).append("]\n"); - debug.append("[lividdagger][").append(ToggleCommand.lividDaggerToggled).append("]\n"); - debug.append("[flowerweapons][").append(ToggleCommand.flowerWeaponsToggled).append("]\n"); debug.append("[sceptremessages][").append(ToggleCommand.sceptreMessages).append("]\n"); debug.append("[petcolors][").append(ToggleCommand.petColoursToggled).append("]\n"); debug.append("[dungeontimer][").append(ToggleCommand.dungeonTimerToggled).append("]\n"); @@ -86,15 +83,11 @@ public class DankerGuiCommand extends CommandBase { debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); debug.append("[clickinorderterminal][").append(ToggleCommand.clickInOrderToggled).append("]\n"); - debug.append("[blockwrongterminalclicks][").append(ToggleCommand.blockWrongTerminalClicksToggled).append("]\n"); - debug.append("[itemframeonsealanterns][").append(ToggleCommand.itemFrameOnSeaLanternsToggled).append("]\n"); debug.append("[ultrasequencer][").append(ToggleCommand.ultrasequencerToggled).append("]\n"); debug.append("[chronomatron][").append(ToggleCommand.chronomatronToggled).append("]\n"); debug.append("[superpairs][").append(ToggleCommand.superpairsToggled).append("]\n"); debug.append("[hidetooltipsinaddons][").append(ToggleCommand.hideTooltipsInExperimentAddonsToggled).append("]\n"); debug.append("[pickblock][").append(ToggleCommand.swapToPickBlockToggled).append("]\n"); - debug.append("[shadowFuryAbility][").append(ToggleCommand.shadowFuryToggled).append("]\n"); - debug.append("[specialhoe][").append(ToggleCommand.specialHoeRightClick).append("]\n"); debug.append("[melodyTooltips][").append(ToggleCommand.melodyTooltips).append("]\n"); debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 73011ad..a6f20fc 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -23,9 +23,6 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean splitFishing; public static boolean chatMaddoxToggled; public static boolean spiritBearAlerts; - public static boolean aotdToggled; - public static boolean lividDaggerToggled; - public static boolean shadowFuryToggled; public static boolean petColoursToggled; public static boolean dungeonTimerToggled; public static boolean ghostTimerToggled; @@ -50,7 +47,6 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean stopSalvageStarredToggled; public static boolean watcherReadyToggled; public static boolean swapToPickBlockToggled; - public static boolean flowerWeaponsToggled; public static boolean notifySlayerSlainToggled; public static boolean necronNotificationsToggled; public static boolean bonzoTimerToggled; @@ -69,14 +65,11 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean startsWithToggled; public static boolean selectAllToggled; public static boolean clickInOrderToggled; - public static boolean blockWrongTerminalClicksToggled; - public static boolean itemFrameOnSeaLanternsToggled; // Experiments public static boolean ultrasequencerToggled; public static boolean chronomatronToggled; public static boolean superpairsToggled; public static boolean hideTooltipsInExperimentAddonsToggled; - public static boolean specialHoeRightClick; public static boolean melodyTooltips; // Custom Music public static boolean dungeonBossMusic; @@ -92,14 +85,14 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; } @@ -116,8 +109,8 @@ public class ToggleCommand extends CommandBase implements ICommand { public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "highlightArachne", - "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "shadowfury", - "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", + "splitfishing", "chatmaddox", "spiritbearalerts", + "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "cooldownmessages", "manamessages", "killcombomessages", "caketimer", "lowhealthnotify", "autoskilltracker", "lividsolver", @@ -125,9 +118,9 @@ public class ToggleCommand extends CommandBase implements ICommand { "bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "boulderpuzzle", "silverfishpuzzle", "icewalkpuzzle", "watchermessage", "startswithterminal", - "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", - "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", - "hidetooltipsinaddons", "pickblock", "specialhoe", "melodytooltips", "highlightslayers", + "selectallterminal", "clickinorderterminal", + "ultrasequencer", "chronomatron", "superpairs", + "hidetooltipsinaddons", "pickblock", "melodytooltips", "highlightslayers", "dungeonbossmusic", "bloodroommusic", "dungeonmusic", "list"); } return null; @@ -188,26 +181,6 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "SpiritBearAlerts", spiritBearAlerts); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Spirit Bear alerts have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + spiritBearAlerts + DankersSkyblockMod.MAIN_COLOUR + ".")); break; - case "aotd": - aotdToggled = !aotdToggled; - ConfigHandler.writeBooleanConfig("toggles", "AOTD", aotdToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block AOTD ability been set to " + DankersSkyblockMod.SECONDARY_COLOUR + aotdToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; - case "lividdagger": - lividDaggerToggled = !lividDaggerToggled; - ConfigHandler.writeBooleanConfig("toggles", "LividDagger", lividDaggerToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block Shadow Fury ability been set to " + DankersSkyblockMod.SECONDARY_COLOUR + shadowFuryToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; - case "shadowfury": - shadowFuryToggled = !shadowFuryToggled; - ConfigHandler.writeBooleanConfig("toggles", "ShadowFury", shadowFuryToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block Livid Dagger ability been set to " + DankersSkyblockMod.SECONDARY_COLOUR + lividDaggerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; - case "flowerweapons": - flowerWeaponsToggled = !flowerWeaponsToggled; - ConfigHandler.writeBooleanConfig("toggles", "FlowerWeapons", flowerWeaponsToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Prevent Placing FoT/Spirit Sceptre been set to " + DankersSkyblockMod.SECONDARY_COLOUR + flowerWeaponsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; case "sceptremessages": sceptreMessages = !sceptreMessages; ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); @@ -384,16 +357,6 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "ClickInOrderTerminal", clickInOrderToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Click in order terminal helper has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + selectAllToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; - case "blockwrongterminalclicks": - blockWrongTerminalClicksToggled = !blockWrongTerminalClicksToggled; - ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", blockWrongTerminalClicksToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block wrong clicks on terminals has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + blockWrongTerminalClicksToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; - case "itemframeonsealanterns": - itemFrameOnSeaLanternsToggled = !itemFrameOnSeaLanternsToggled; - ConfigHandler.writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", itemFrameOnSeaLanternsToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ignore item frames on sea lanterns has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + itemFrameOnSeaLanternsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; case "ultrasequencer": ultrasequencerToggled = !ultrasequencerToggled; ConfigHandler.writeBooleanConfig("toggles", "UltraSequencer", ultrasequencerToggled); @@ -419,11 +382,6 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "PickBlock", swapToPickBlockToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto-swap to pick block has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + swapToPickBlockToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; - case "specialhoe": - specialHoeRightClick = !specialHoeRightClick; - ConfigHandler.writeBooleanConfig("toggles", "SpecialHoe", specialHoeRightClick); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block right click ability of special hoes " + DankersSkyblockMod.SECONDARY_COLOUR + specialHoeRightClick + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; case "melodytooltips": melodyTooltips = !melodyTooltips; ConfigHandler.writeBooleanConfig("toggles", "MelodyTooltips", melodyTooltips); @@ -465,9 +423,6 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Split fishing display: " + DankersSkyblockMod.VALUE_COLOUR + splitFishing + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Chat Maddox menu: " + DankersSkyblockMod.VALUE_COLOUR + chatMaddoxToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Spirit Bear alerts: " + DankersSkyblockMod.VALUE_COLOUR + spiritBearAlerts + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Block AOTD ability: " + DankersSkyblockMod.VALUE_COLOUR + aotdToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Block Livid Dagger ability: " + DankersSkyblockMod.VALUE_COLOUR + lividDaggerToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Prevent Placing FoT/Spirit Sceptre: " + DankersSkyblockMod.VALUE_COLOUR + flowerWeaponsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Spirit Sceptre messages: " + DankersSkyblockMod.VALUE_COLOUR + sceptreMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Midas Staff messages: " + DankersSkyblockMod.VALUE_COLOUR + midasStaffMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Implosion messages: " + DankersSkyblockMod.VALUE_COLOUR + implosionMessages + "\n" + @@ -496,13 +451,11 @@ public class ToggleCommand extends CommandBase implements ICommand { 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" + - DankersSkyblockMod.TYPE_COLOUR + " Ignore item frames on sea lanterns: " + DankersSkyblockMod.VALUE_COLOUR + itemFrameOnSeaLanternsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Ultra sequencer solver: " + DankersSkyblockMod.VALUE_COLOUR + ultrasequencerToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Superpairs solver: " + DankersSkyblockMod.VALUE_COLOUR + superpairsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in experiment addons: " + DankersSkyblockMod.VALUE_COLOUR + hideTooltipsInExperimentAddonsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Auto-swap to pick block " + DankersSkyblockMod.VALUE_COLOUR + swapToPickBlockToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Block Special Hoe right click " + DankersSkyblockMod.VALUE_COLOUR + specialHoeRightClick + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in Melody's Harp " + DankersSkyblockMod.VALUE_COLOUR + melodyTooltips + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Highlight Slayer Bosses " + DankersSkyblockMod.VALUE_COLOUR + highlightSlayers + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Highlight Arachne Boss " + DankersSkyblockMod.VALUE_COLOUR + highlightArachne + "\n" + diff --git a/src/main/java/me/Danker/features/BlockAbilities.java b/src/main/java/me/Danker/features/BlockAbilities.java deleted file mode 100644 index 814fd65..0000000 --- a/src/main/java/me/Danker/features/BlockAbilities.java +++ /dev/null @@ -1,96 +0,0 @@ -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); - } - if (ToggleCommand.shadowFuryToggled && item.getDisplayName().contains("Shadow Fury")) { - event.setCanceled(true); - } - if (ToggleCommand.specialHoeRightClick && (item.getDisplayName().contains("Mathematical Hoe") || item.getDisplayName().contains("Potato Hoe") || item.getDisplayName().contains("Wheat Hoe") || item.getDisplayName().contains("Carrot Hoe") || item.getDisplayName().contains("Sugar Cane Hoe") || item.getDisplayName().contains("Nether Warts Hoe"))) { - 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); - } - if (ToggleCommand.shadowFuryToggled && item.getDisplayName().contains("Shadow Fury")) { - event.setCanceled(true); - } - } - if (ToggleCommand.specialHoeRightClick && (item.getDisplayName().contains("Mathematical Hoe") || item.getDisplayName().contains("Potato Hoe") || item.getDisplayName().contains("Wheat Hoe") || item.getDisplayName().contains("Carrot Hoe") || item.getDisplayName().contains("Sugar Cane Hoe") || item.getDisplayName().contains("Nether Warts Hoe"))) { - event.setCanceled(true); - } - } - } - -} diff --git a/src/main/java/me/Danker/features/BlockPlacingFlowers.java b/src/main/java/me/Danker/features/BlockPlacingFlowers.java deleted file mode 100644 index 9bfc986..0000000 --- a/src/main/java/me/Danker/features/BlockPlacingFlowers.java +++ /dev/null @@ -1,44 +0,0 @@ -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 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/BlockWrongSlayer.java b/src/main/java/me/Danker/features/BlockWrongSlayer.java deleted file mode 100644 index 6da4798..0000000 --- a/src/main/java/me/Danker/features/BlockWrongSlayer.java +++ /dev/null @@ -1,42 +0,0 @@ -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/puzzlesolvers/ArrowTerminalSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java deleted file mode 100644 index 35458f3..0000000 --- a/src/main/java/me/Danker/features/puzzlesolvers/ArrowTerminalSolver.java +++ /dev/null @@ -1,32 +0,0 @@ -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/BlockWrongTerminalClicks.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java deleted file mode 100644 index 5176e8b..0000000 --- a/src/main/java/me/Danker/features/puzzlesolvers/BlockWrongTerminalClicks.java +++ /dev/null @@ -1,112 +0,0 @@ -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 BEAN"))); - } - } - - 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 index 7bbd25a..208cf9b 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/ChronomatronSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/ChronomatronSolver.java @@ -15,7 +15,6 @@ 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; @@ -33,20 +32,10 @@ public class ChronomatronSolver { 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 (item == null) 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); } } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java index 87309fe..3df6fc4 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/UltrasequencerSolver.java @@ -1,20 +1,17 @@ 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; @@ -52,28 +49,6 @@ public class UltrasequencerSolver { } } - @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 (")) { diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index d8100b5..569f4d1 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -35,7 +35,6 @@ public class DankerGui extends GuiScreen { private GuiTextField search; private GuiButton changeDisplay; - private GuiButton onlySlayer; private GuiButton puzzleSolvers; private GuiButton experimentationTableSolvers; private GuiButton skillTracker; @@ -49,7 +48,6 @@ public class DankerGui extends GuiScreen { private GuiButton splitFishing; private GuiButton chatMaddox; private GuiButton spiritBearAlert; - private GuiButton aotd; private GuiButton petColours; private GuiButton golemAlerts; private GuiButton expertiseLore; @@ -58,13 +56,11 @@ public class DankerGui extends GuiScreen { private GuiButton cakeTimer; private GuiButton pickBlock; private GuiButton notifySlayerSlain; - private GuiButton shadowFury; - private GuiButton specialHoe; private GuiButton melodyTooltips; private GuiButton autoSkillTracker; private GuiButton highlightArachne; + private GuiButton highlightSlayer; // Chat Messages - private GuiButton lividDagger; private GuiButton sceptreMessages; private GuiButton midasStaffMessages; private GuiButton implosionMessages; @@ -78,7 +74,6 @@ public class DankerGui extends GuiScreen { private GuiButton lividSolver; private GuiButton stopSalvageStarred; private GuiButton watcherReadyMessage; - private GuiButton flowerWeapons; private GuiButton necronNotifications; private GuiButton bonzoTimer; @@ -110,7 +105,6 @@ public class DankerGui extends GuiScreen { search = new GuiTextField(0, this.fontRendererObj, width - 202, 5, 200, 20); changeDisplay = new GuiButton(0, 0, 0, "Change Display Settings"); - onlySlayer = new GuiButton(0, 0, 0, "Set Slayer Quest"); puzzleSolvers = new GuiButton(0, 0, 0, "Toggle Dungeons Puzzle Solvers"); experimentationTableSolvers = new GuiButton(0, 0, 0, "Toggle Experimentation Table Solvers"); skillTracker = new GuiButton(0, 0, 0, "Toggle Skill XP/Hour Tracking"); @@ -122,8 +116,6 @@ public class DankerGui extends GuiScreen { cakeTimer = new GuiButton(0, 0, 0, "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); skill50Display = new GuiButton(0, 0, 0, "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); slayerCount = new GuiButton(0, 0, 0, "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); - aotd = new GuiButton(0, 0, 0, "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); - lividDagger = new GuiButton(0, 0, 0, "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); spiritBearAlert = new GuiButton(0, 0, 0, "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); sceptreMessages = new GuiButton(0, 0, 0, "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); midasStaffMessages = new GuiButton(0, 0, 0, "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); @@ -144,18 +136,15 @@ public class DankerGui extends GuiScreen { dungeonTimer = new GuiButton(0, 0, 0, "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); stopSalvageStarred = new GuiButton(0, 0, 0, "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); watcherReadyMessage = new GuiButton(0, 0, 0, "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); - flowerWeapons = new GuiButton(0, 0, 0, "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); notifySlayerSlain = new GuiButton(0, 0, 0, "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); necronNotifications = new GuiButton(0, 0, 0, "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); bonzoTimer = new GuiButton(0, 0, 0, "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); autoSkillTracker = new GuiButton(0, 0, 0, "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); - shadowFury = new GuiButton(0, 0, 0, "Block Shadow Fury ability: " + Utils.getColouredBoolean(ToggleCommand.shadowFuryToggled)); - specialHoe = new GuiButton(0, 0, 0, "Block Special Hoe right click: " + Utils.getColouredBoolean(ToggleCommand.specialHoeRightClick)); melodyTooltips = new GuiButton(0, 0, 0, "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips)); highlightArachne = new GuiButton(0, 0, 0, "Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne)); + highlightSlayer = new GuiButton(0, 0, 0, "Highlight Slayer: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers)); allButtons.add(changeDisplay); - allButtons.add(onlySlayer); allButtons.add(puzzleSolvers); allButtons.add(experimentationTableSolvers); allButtons.add(skillTracker); @@ -167,8 +156,6 @@ public class DankerGui extends GuiScreen { allButtons.add(cakeTimer); allButtons.add(skill50Display); allButtons.add(slayerCount); - allButtons.add(aotd); - allButtons.add(lividDagger); allButtons.add(spiritBearAlert); allButtons.add(sceptreMessages); allButtons.add(midasStaffMessages); @@ -189,15 +176,13 @@ public class DankerGui extends GuiScreen { allButtons.add(dungeonTimer); allButtons.add(stopSalvageStarred); allButtons.add(watcherReadyMessage); - allButtons.add(flowerWeapons); allButtons.add(notifySlayerSlain); allButtons.add(necronNotifications); allButtons.add(bonzoTimer); allButtons.add(autoSkillTracker); - allButtons.add(shadowFury); - allButtons.add(specialHoe); allButtons.add(melodyTooltips); allButtons.add(highlightArachne); + allButtons.add(highlightSlayer); search.setText(initSearchText); search.setVisible(true); @@ -273,8 +258,6 @@ public class DankerGui extends GuiScreen { } } else if (button == changeDisplay) { DankersSkyblockMod.guiToOpen = "displaygui"; - } else if (button == onlySlayer) { - DankersSkyblockMod.guiToOpen = "onlyslayergui"; } else if (button == puzzleSolvers) { DankersSkyblockMod.guiToOpen = "puzzlesolvers"; } else if (button == experimentationTableSolvers) { @@ -303,14 +286,6 @@ public class DankerGui extends GuiScreen { ToggleCommand.slayerCountTotal = !ToggleCommand.slayerCountTotal; ConfigHandler.writeBooleanConfig("toggles", "SlayerCount", ToggleCommand.slayerCountTotal); slayerCount.displayString = "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal); - } else if (button == aotd) { - ToggleCommand.aotdToggled = !ToggleCommand.aotdToggled; - ConfigHandler.writeBooleanConfig("toggles", "AOTD", ToggleCommand.aotdToggled); - aotd.displayString = "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled); - } else if (button == lividDagger) { - ToggleCommand.lividDaggerToggled = !ToggleCommand.lividDaggerToggled; - ConfigHandler.writeBooleanConfig("toggles", "LividDagger", ToggleCommand.lividDaggerToggled); - lividDagger.displayString = "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled); } else if (button == sceptreMessages) { ToggleCommand.sceptreMessages = !ToggleCommand.sceptreMessages; ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", ToggleCommand.sceptreMessages); @@ -407,22 +382,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.swapToPickBlockToggled = !ToggleCommand.swapToPickBlockToggled; ConfigHandler.writeBooleanConfig("toggles", "PickBlock", ToggleCommand.swapToPickBlockToggled); pickBlock.displayString = "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockToggled); - } else if (button == flowerWeapons) { - ToggleCommand.flowerWeaponsToggled = !ToggleCommand.flowerWeaponsToggled; - ConfigHandler.writeBooleanConfig("toggles", "FlowerWeapons", ToggleCommand.flowerWeaponsToggled); - flowerWeapons.displayString = "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled); } else if (button == autoSkillTracker) { ToggleCommand.autoSkillTrackerToggled = !ToggleCommand.autoSkillTrackerToggled; ConfigHandler.writeBooleanConfig("toggles", "AutoSkillTracker", ToggleCommand.autoSkillTrackerToggled); autoSkillTracker.displayString = "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled); - } else if (button == shadowFury) { - ToggleCommand.shadowFuryToggled = !ToggleCommand.shadowFuryToggled; - ConfigHandler.writeBooleanConfig("toggles", "ShadowFury", ToggleCommand.shadowFuryToggled); - shadowFury.displayString = "Block Shadow Fury ability: " + Utils.getColouredBoolean(ToggleCommand.shadowFuryToggled); - } else if (button == specialHoe) { - ToggleCommand.specialHoeRightClick = !ToggleCommand.specialHoeRightClick; - ConfigHandler.writeBooleanConfig("toggles", "SpecialHoe", ToggleCommand.specialHoeRightClick); - specialHoe.displayString = "Block Special Hoe right click: " + Utils.getColouredBoolean(ToggleCommand.specialHoeRightClick); } else if (button == melodyTooltips) { ToggleCommand.melodyTooltips = !ToggleCommand.melodyTooltips; ConfigHandler.writeBooleanConfig("toggles", "MelodyTooltips", ToggleCommand.melodyTooltips); @@ -435,6 +398,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.highlightArachne = !ToggleCommand.highlightArachne; ConfigHandler.writeBooleanConfig("toggles", "HighlightArachne", ToggleCommand.highlightArachne); highlightArachne.displayString = "Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne); + } else if (button == highlightSlayer) { + ToggleCommand.highlightSlayers = !ToggleCommand.highlightSlayers; + ConfigHandler.writeBooleanConfig("toggles", "HighlightSlayers", ToggleCommand.highlightSlayers); + highlightSlayer.displayString = "Highlight Slayer: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers); } } diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java deleted file mode 100644 index ec26a13..0000000 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ /dev/null @@ -1,165 +0,0 @@ -package me.Danker.gui; - -import me.Danker.DankersSkyblockMod; -import me.Danker.commands.ToggleCommand; -import me.Danker.features.BlockWrongSlayer; -import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.TextRenderer; -import me.Danker.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; - -public class OnlySlayerGui extends GuiScreen { - - private int onlyNumberInt = 4; - private String onlyName = "Revenant Horror"; - - private GuiButton goBack; - private GuiButton off; - private GuiButton zombie; - private GuiButton spider; - private GuiButton wolf; - private GuiButton one; - private GuiButton two; - private GuiButton three; - private GuiButton four; - private GuiButton five; - private GuiButton highlightSlayers; - - @Override - public boolean doesGuiPauseGame() { - return false; - } - - @Override - public void initGui() { - super.initGui(); - - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - int height = sr.getScaledHeight(); - int width = sr.getScaledWidth(); - - onlyName = BlockWrongSlayer.onlySlayerName; - switch (BlockWrongSlayer.onlySlayerNumber) { - case "I": - onlyNumberInt = 1; - break; - case "II": - onlyNumberInt = 2; - break; - case "III": - onlyNumberInt = 3; - break; - case "IV": - default: - onlyNumberInt = 4; - break; - case "V": - onlyNumberInt = 5; - break; - } - - goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); - off = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Off"); - zombie = new GuiButton(0, width / 2 - 200, (int) (height * 0.4), 120, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 60, (int) (height * 0.4), 120, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 80, (int) (height * 0.4), 120, 20, "Wolf"); - one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 60, 20, "I"); - two = new GuiButton(0, width / 2 - 110, (int) (height * 0.6), 60, 20, "II"); - three = new GuiButton(0, width / 2 - 30, (int) (height * 0.6), 60, 20, "III"); - four = new GuiButton(0, width / 2 + 50, (int) (height * 0.6), 60, 20, "IV"); - five = new GuiButton(0, width / 2 + 130, (int) (height * 0.6), 60, 20, "V"); - highlightSlayers = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Highlight Slayer Bosses: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers)); - - this.buttonList.add(off); - this.buttonList.add(zombie); - this.buttonList.add(spider); - this.buttonList.add(wolf); - this.buttonList.add(one); - this.buttonList.add(two); - this.buttonList.add(three); - this.buttonList.add(four); - this.buttonList.add(five); - this.buttonList.add(highlightSlayers); - this.buttonList.add(goBack); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - Minecraft mc = Minecraft.getMinecraft(); - - String displayText; - if (BlockWrongSlayer.onlySlayerName.equals("")) { - displayText = "Only Allow Slayer: Off"; - } else { - displayText = "Only Allow Slayer: " + BlockWrongSlayer.onlySlayerName + " " + BlockWrongSlayer.onlySlayerNumber; - } - int displayWidth = mc.fontRendererObj.getStringWidth(displayText); - new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); - - super.drawScreen(mouseX, mouseY, partialTicks); - } - - @Override - public void actionPerformed(GuiButton button) { - if (button == goBack) { - DankersSkyblockMod.guiToOpen = "dankergui1"; - return; - } else if (button == off) { - BlockWrongSlayer.onlySlayerName = ""; - BlockWrongSlayer.onlySlayerNumber = ""; - ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); - return; - } else if (button == zombie) { - onlyName = "Revenant Horror"; - } else if (button == spider) { - onlyName = "Tarantula Broodfather"; - } else if (button == wolf) { - onlyName = "Sven Packmaster"; - } else if (button == one) { - onlyNumberInt = 1; - } else if (button == two) { - onlyNumberInt = 2; - } else if (button == three) { - onlyNumberInt = 3; - } else if (button == four) { - onlyNumberInt = 4; - } else if (button == five) { - onlyNumberInt = 5; - } else if (button == highlightSlayers) { - ToggleCommand.highlightSlayers = !ToggleCommand.highlightSlayers; - ConfigHandler.writeBooleanConfig("toggles", "HighlightSlayers", ToggleCommand.highlightSlayers); - highlightSlayers.displayString = "Highlight Slayer Bosses: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers); - return; - } - - String onlyNumber; - switch (onlyNumberInt) { - case 1: - onlyNumber = "I"; - break; - case 2: - onlyNumber = "II"; - break; - case 3: - onlyNumber = "III"; - break; - case 4: - onlyNumber = "IV"; - break; - case 5: - onlyNumber = "V"; - break; - default: - onlyNumber = "IV"; - } - - BlockWrongSlayer.onlySlayerName = onlyName; - BlockWrongSlayer.onlySlayerNumber = onlyNumber; - ConfigHandler.writeStringConfig("toggles", "BlockSlayer", BlockWrongSlayer.onlySlayerName + " " + BlockWrongSlayer.onlySlayerNumber); - } - -} diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 3bb16a0..70cd982 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -28,8 +28,6 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; - private GuiButton blockClicks; - private GuiButton itemFrameOnSeaLanterns; public PuzzleSolversGui(int page) { this.page = page; @@ -66,8 +64,6 @@ public class PuzzleSolversGui extends GuiScreen { startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); - blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -86,8 +82,6 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); - this.buttonList.add(blockClicks); - this.buttonList.add(itemFrameOnSeaLanterns); this.buttonList.add(backPage); break; } @@ -156,14 +150,6 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.clickInOrderToggled = !ToggleCommand.clickInOrderToggled; ConfigHandler.writeBooleanConfig("toggles", "ClickInOrderTerminal", ToggleCommand.clickInOrderToggled); clickOrder.displayString = "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled); - } else if (button == blockClicks) { - ToggleCommand.blockWrongTerminalClicksToggled = !ToggleCommand.blockWrongTerminalClicksToggled; - ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", ToggleCommand.blockWrongTerminalClicksToggled); - blockClicks.displayString = "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled); - } else if (button == itemFrameOnSeaLanterns) { - ToggleCommand.itemFrameOnSeaLanternsToggled = !ToggleCommand.itemFrameOnSeaLanternsToggled; - ConfigHandler.writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", ToggleCommand.itemFrameOnSeaLanternsToggled); - itemFrameOnSeaLanterns.displayString = "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 04f4ccd..d3b7464 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -219,16 +219,12 @@ public class ConfigHandler { 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.shadowFuryToggled = initBoolean("toggles", "Shadow Fury", 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); - ToggleCommand.specialHoeRightClick = initBoolean("toggles", "SpecialHoe", false); ToggleCommand.melodyTooltips = initBoolean("toggles", "MelodyTooltips", false); ToggleCommand.highlightSlayers = initBoolean("toggles", "HighlightSlayers", false); ToggleCommand.highlightArachne = initBoolean("toggles", "HighlightArachne", false); @@ -250,7 +246,6 @@ public class ConfigHandler { 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 = initBoolean("toggles", "ThreeManPuzzle", false); @@ -265,8 +260,6 @@ public class ConfigHandler { 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 = initBoolean("toggles", "UltraSequencer", false); ToggleCommand.chronomatronToggled = initBoolean("toggles", "Chronomatron", false); @@ -283,14 +276,6 @@ public class ConfigHandler { // 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(" ")); - BlockWrongSlayer.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1); - } // Wolf LootTracker.wolfSvens = initInt("wolf", "svens", 0); diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java index da7900a..a4fd85e 100644 --- a/src/main/java/me/Danker/handlers/PacketHandler.java +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -2,19 +2,10 @@ package me.Danker.handlers; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelPromise; -import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; -import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.server.S04PacketEntityEquipment; -import net.minecraft.util.BlockPos; import java.lang.reflect.Field; @@ -36,26 +27,4 @@ public class PacketHandler extends ChannelDuplexHandler { super.channelRead(ctx, msg); } - // Ignore item frames with arrows on sea lanterns - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - if (ToggleCommand.itemFrameOnSeaLanternsToggled && Utils.inDungeons && msg instanceof Packet && msg.getClass().getName().endsWith("C02PacketUseEntity")) { - Minecraft mc = Minecraft.getMinecraft(); - C02PacketUseEntity packet = (C02PacketUseEntity) msg; - Entity entityHit = packet.getEntityFromWorld(mc.theWorld); - if (entityHit instanceof EntityItemFrame) { - EntityItemFrame itemFrame = (EntityItemFrame) entityHit; - ItemStack item = itemFrame.getDisplayedItem(); - if (item != null && item.getItem() == Items.arrow) { - BlockPos blockPos = Utils.getBlockUnderItemFrame(itemFrame); - if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { - return; - } - } - } - } - - super.write(ctx, msg, promise); - } - } -- cgit