diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-07-31 19:58:02 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-07-31 19:58:02 -0400 |
commit | a49b673bd9badcb7c4c02539f53c39c5b52c1b32 (patch) | |
tree | 649d076f99fe34d45fec19e86a36b9c5e8a120c1 /src | |
parent | 342c6c8c6096db1e3e0e2ea4363ba34764f1121b (diff) | |
download | SkyblockMod-a49b673bd9badcb7c4c02539f53c39c5b52c1b32.tar.gz SkyblockMod-a49b673bd9badcb7c4c02539f53c39c5b52c1b32.tar.bz2 SkyblockMod-a49b673bd9badcb7c4c02539f53c39c5b52c1b32.zip |
Add custom music to every area
Hub, island, farming islands, gold mine, deep caverns, dwarven mines, crystal hollows, blazing fortress, end, park
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 4 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/CustomMusicCommand.java | 88 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 100 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/CrystalHollowWaypoints.java | 6 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/CustomMusic.java | 133 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/CustomMusicGui.java | 118 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 22 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 13 |
8 files changed, 426 insertions, 58 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 9258892..100db96 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -360,7 +360,7 @@ public class DankersSkyblockMod { if (player != null) { Utils.checkForSkyblock(); Utils.checkForDungeons(); - Utils.checkForCrystalHollows(); + Utils.checkTabLocation(); } tickAmount = 0; @@ -427,7 +427,7 @@ public class DankersSkyblockMod { mc.displayGuiScreen(new SkillTrackerGui()); break; case "custommusic": - mc.displayGuiScreen(new CustomMusicGui()); + mc.displayGuiScreen(new CustomMusicGui(1)); break; case "crystalwaypoints": mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java index 0e80dd3..45e3770 100644 --- a/src/main/java/me/Danker/commands/CustomMusicCommand.java +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -24,7 +24,8 @@ public class CustomMusicCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <stop/reload/volume> [dungeonboss/bloodroom/dungeon] [1-100]"; + return "/" + getCommandName() + " <stop/reload/volume> [dungeonboss/bloodroom/dungeon/hub/island/dungeonhub/farmingislands/" + + "goldmine/deepcaverns/dwarvenmines/crystalhollows/blazingfortress/end/park] [1-100]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +42,8 @@ public class CustomMusicCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "stop", "reload", "volume"); } else if (args.length == 2) { - return getListOfStringsMatchingLastWord(args, "dungeonboss", "bloodroom", "dungeon"); + return getListOfStringsMatchingLastWord(args, "dungeonboss", "bloodroom", "dungeon", "hub", "island", "dungeonhub", "farmingislands", "goldmine", + "deepcaverns", "dwarvenmines", "crystalhollows", "blazingfortress", "end", "park"); } return null; } @@ -76,36 +78,92 @@ public class CustomMusicCommand extends CommandBase { } int volume = Integer.parseInt(arg1[2]); - boolean success; switch (arg1[1].toLowerCase()) { case "dungeonboss": - success = CustomMusic.dungeonboss.setVolume(volume); - if (!success) { - return; - } + if (!CustomMusic.dungeonboss.setVolume(volume)) return; CustomMusic.dungeonbossVolume = volume; ConfigHandler.writeIntConfig("music", "DungeonBossVolume", volume); break; case "bloodroom": - success = CustomMusic.bloodroom.setVolume(volume); - if (!success) { - return; - } + if (!CustomMusic.bloodroom.setVolume(volume)) return; CustomMusic.bloodroomVolume = volume; ConfigHandler.writeIntConfig("music", "BloodRoomVolume", volume); break; case "dungeon": - success = CustomMusic.dungeon.setVolume(volume); - if (!success) { - return; - } + if (!CustomMusic.dungeon.setVolume(volume)) return; CustomMusic.dungeonVolume = volume; ConfigHandler.writeIntConfig("music", "DungeonVolume", volume); break; + case "hub": + if (!CustomMusic.hub.setVolume(volume)) return; + + CustomMusic.hubVolume = volume; + ConfigHandler.writeIntConfig("music", "HubVolume", volume); + break; + case "island": + if (!CustomMusic.island.setVolume(volume)) return; + + CustomMusic.islandVolume = volume; + ConfigHandler.writeIntConfig("music", "IslandVolume", volume); + break; + case "dungeonhub": + if (!CustomMusic.dungeonHub.setVolume(volume)) return; + + CustomMusic.dungeonHubVolume = volume; + ConfigHandler.writeIntConfig("music", "DungeonHubVolume", volume); + break; + case "farmingislands": + if (!CustomMusic.farmingIslands.setVolume(volume)) return; + + CustomMusic.farmingIslandsVolume = volume; + ConfigHandler.writeIntConfig("music", "FarmingIslandsVolume", volume); + break; + case "goldmine": + if (!CustomMusic.goldMine.setVolume(volume)) return; + + CustomMusic.goldMineVolume = volume; + ConfigHandler.writeIntConfig("music", "GoldMineVolume", volume); + break; + case "deepcaverns": + if (!CustomMusic.deepCaverns.setVolume(volume)) return; + + CustomMusic.deepCavernsVolume = volume; + ConfigHandler.writeIntConfig("music", "DeepCavernsVolume", volume); + break; + case "dwarvenmines": + if (!CustomMusic.dwarvenMines.setVolume(volume)) return; + + CustomMusic.dwarvenMinesVolume = volume; + ConfigHandler.writeIntConfig("music", "DwarvenMinesVolume", volume); + break; + case "crystalhollows": + if (!CustomMusic.crystalHollows.setVolume(volume)) return; + + CustomMusic.crystalHollowsVolume = volume; + ConfigHandler.writeIntConfig("music", "CrystalHollowsVolume", volume); + break; + case "blazingfortress": + if (!CustomMusic.blazingFortress.setVolume(volume)) return; + + CustomMusic.blazingFortressVolume = volume; + ConfigHandler.writeIntConfig("music", "BlazingFortressVolume", volume); + break; + case "end": + if (!CustomMusic.end.setVolume(volume)) return; + + CustomMusic.endVolume = volume; + ConfigHandler.writeIntConfig("music", "EndVolume", volume); + break; + case "park": + if (!CustomMusic.park.setVolume(volume)) return; + + CustomMusic.parkVolume = volume; + ConfigHandler.writeIntConfig("music", "ParkVolume", volume); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index c810eff..65900fd 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -14,6 +14,7 @@ import net.minecraft.util.ChatComponentText; import java.util.List; public class ToggleCommand extends CommandBase implements ICommand { + // i hate this file so much // Some of these end with toggled and some don't, I don't want to go back and fix them all for consistency public static boolean gpartyToggled; public static boolean coordsToggled; @@ -87,6 +88,17 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean dungeonBossMusic; public static boolean bloodRoomMusic; public static boolean dungeonMusic; + public static boolean hubMusic; + public static boolean islandMusic; + public static boolean dungeonHubMusic; + public static boolean farmingIslandsMusic; + public static boolean goldMineMusic; + public static boolean deepCavernsMusic; + public static boolean dwarvenMinesMusic; + public static boolean crystalHollowsMusic; + public static boolean blazingFortressMusic; + public static boolean endMusic; + public static boolean parkMusic; @Override public String getCommandName() { @@ -105,7 +117,9 @@ public class ToggleCommand extends CommandBase implements ICommand { "ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" + "melodytooltips/highlightslayers/highlightarachne/highlightskeletonmasters/teammatesinradius/" + "gianthp/hidepetcandy/customcolorednames/endoffarmalert/gemstonelore/crystalhollowwaypoints/crystalautowaypoints/" + - "autoacceptreparty/dungeonbossmusic/bloodroommusic/dungeonmusic/list>"; + "autoacceptreparty/dungeonbossmusic/bloodroommusic/dungeonmusic/hubmusic/islandmusic/dungeonhubmusic/" + + "farmingislandsmusic/goldminemusic/deepcavernsmusic/crystalhollowsmusic/blazingfortressmusic/endmusic/" + + "parkmusic/list>"; } public static String usage(ICommandSender arg0) { @@ -135,7 +149,10 @@ public class ToggleCommand extends CommandBase implements ICommand { "hidetooltipsinaddons", "pickblock", "melodytooltips", "highlightslayers", "highlightskeletonmasters", "dungeonbossmusic", "bloodroommusic", "dungeonmusic", "teammatesinradius", "gianthp", "hidepetcandy", "customcolorednames", "endoffarmalert", - "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "autoacceptreparty", "list"); + "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "autoacceptreparty", + "hubmusic", "islandmusic", "dungeonhubmusic", "farmingislandsmusic", "goldminemusic", + "deepcavernsmusic", "dwarvenminesmusic", "crystalhollowsmusic", "blazingfortressmusic", + "endmusic", "parkmusic", "list"); } return null; } @@ -485,6 +502,72 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 "hubmusic": + hubMusic = !hubMusic; + CustomMusic.hub.stop(); + ConfigHandler.writeBooleanConfig("toggles", "HubMusic", hubMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom hub music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + hubMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "islandmusic": + islandMusic = !islandMusic; + CustomMusic.island.stop(); + ConfigHandler.writeBooleanConfig("toggles", "IslandMusic", islandMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom island music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + islandMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "dungeonhubmusic": + dungeonHubMusic = !dungeonHubMusic; + CustomMusic.dungeonHub.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DungeonHubMusic", dungeonHubMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom dungeon hub music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonHubMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "farmingislandsmusic": + farmingIslandsMusic = !farmingIslandsMusic; + CustomMusic.farmingIslands.stop(); + ConfigHandler.writeBooleanConfig("toggles", "FarmingIslandsMusic", farmingIslandsMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom farming islands music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + farmingIslandsMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "goldminemusic": + goldMineMusic = !goldMineMusic; + CustomMusic.goldMine.stop(); + ConfigHandler.writeBooleanConfig("toggles", "GoldMineMusic", goldMineMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom gold mine music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + goldMineMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "deepcavernsmusic": + deepCavernsMusic = !deepCavernsMusic; + CustomMusic.deepCaverns.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DeepCavernsMusic", deepCavernsMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom deep caverns music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + deepCavernsMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "dwarvenminesmusic": + dwarvenMinesMusic = !dwarvenMinesMusic; + CustomMusic.dwarvenMines.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DwarvenMinesMusic", dwarvenMinesMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom dwarven mines music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dwarvenMinesMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "crystalhollowsmusic": + crystalHollowsMusic = !crystalHollowsMusic; + CustomMusic.crystalHollows.stop(); + ConfigHandler.writeBooleanConfig("toggles", "CrystalHollowsMusic", crystalHollowsMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom crystal hollows music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + crystalHollowsMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "blazingfortressmusic": + blazingFortressMusic = !blazingFortressMusic; + CustomMusic.blazingFortress.stop(); + ConfigHandler.writeBooleanConfig("toggles", "BlazingFortressMusic", blazingFortressMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom blazing fortress music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + blazingFortressMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "endmusic": + endMusic = !endMusic; + CustomMusic.end.stop(); + ConfigHandler.writeBooleanConfig("toggles", "EndMusic", endMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom end music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + endMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "parkmusic": + parkMusic = !parkMusic; + CustomMusic.park.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DungeonMusic", parkMusic); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom park music has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + parkMusic + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "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" + @@ -543,7 +626,18 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Auto accept reparty: " + DankersSkyblockMod.VALUE_COLOUR + autoAcceptReparty + "\n" + 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 + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom hub music: " + DankersSkyblockMod.VALUE_COLOUR + hubMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom island music: " + DankersSkyblockMod.VALUE_COLOUR + islandMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon hub music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonHubMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom farming islands music: " + DankersSkyblockMod.VALUE_COLOUR + farmingIslandsMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom gold mine music: " + DankersSkyblockMod.VALUE_COLOUR + goldMineMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom deep caverns music: " + DankersSkyblockMod.VALUE_COLOUR + deepCavernsMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom dwarven mines music: " + DankersSkyblockMod.VALUE_COLOUR + dwarvenMinesMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom crystal hollows music: " + DankersSkyblockMod.VALUE_COLOUR + crystalHollowsMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom blazing fortress music: " + DankersSkyblockMod.VALUE_COLOUR + blazingFortressMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom end music: " + DankersSkyblockMod.VALUE_COLOUR + endMusic + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Custom park music: " + DankersSkyblockMod.VALUE_COLOUR + parkMusic )); break; default: diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java index 17578fe..37f709a 100644 --- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -44,7 +44,7 @@ public class CrystalHollowWaypoints { World world = mc.theWorld; if (DankersSkyblockMod.tickAmount % 20 == 0) { - if (ToggleCommand.crystalAutoWaypoints && Utils.inCrystalHollows && world != null) { + if (ToggleCommand.crystalAutoWaypoints && Utils.tabLocation.equals("Crystal Hollows") && world != null) { boolean found = false; List<String> scoreboard = ScoreboardHandler.getSidebarLines(); @@ -118,7 +118,7 @@ public class CrystalHollowWaypoints { $SBECHWP:Mines of Divan@-673,117,426 $SBECHWP:Khazad-dûm@-292,63,281\nFairy Grotto@-216,110,400\njungle temple@-525,110,395\nJungle Temple@-493,101,425\nMines of Divan@-673,117,426 */ - if (ToggleCommand.crystalHollowWaypoints && Utils.inCrystalHollows) { + if (ToggleCommand.crystalHollowWaypoints && Utils.tabLocation.equals("Crystal Hollows")) { if (!message.contains(player.getName()) && (message.contains(": $DSMCHWP:") || message.contains(": $SBECHWP:"))) { ChatComponentText add = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [ADD]\n"); add.setChatStyle(add.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dsmaddcrystalhollowwaypoints " + message.substring(message.lastIndexOf(":") + 1)))); @@ -137,7 +137,7 @@ public class CrystalHollowWaypoints { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { - if (ToggleCommand.crystalHollowWaypoints && Utils.inCrystalHollows) { + if (ToggleCommand.crystalHollowWaypoints && Utils.tabLocation.equals("Crystal Hollows")) { for (Waypoint waypoint : waypoints) { if (waypoint.toggled) Utils.draw3DWaypointString(waypoint, event.partialTicks); } diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 5080821..d61b640 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -35,6 +35,29 @@ public class CustomMusic { public static int bloodroomVolume; public static Song dungeon; public static int dungeonVolume; + public static Song hub; + public static int hubVolume; + public static Song island; + public static int islandVolume; + public static Song dungeonHub; + public static int dungeonHubVolume; + public static Song farmingIslands; + public static int farmingIslandsVolume; + public static Song goldMine; + public static int goldMineVolume; + public static Song deepCaverns; + public static int deepCavernsVolume; + public static Song dwarvenMines; + public static int dwarvenMinesVolume; + public static Song crystalHollows; + public static int crystalHollowsVolume; + public static Song blazingFortress; + public static int blazingFortressVolume; + public static Song end; + public static int endVolume; + public static Song park; + public static int parkVolume; + @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -49,28 +72,66 @@ public class CustomMusic { EntityPlayerSP player = mc.thePlayer; World world = mc.theWorld; if (DankersSkyblockMod.tickAmount % 10 == 0) { - if (Utils.inDungeons && world != null && player != null) { - prevInDungeonBossRoom = inDungeonBossRoom; - List<String> 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) { - bloodroom.stop(); - if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); + if (world != null && player != null) { + if (Utils.inDungeons) { + prevInDungeonBossRoom = inDungeonBossRoom; + List<String> 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) { + bloodroom.stop(); + if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); + } + } else { + inDungeonBossRoom = false; } - } else { - inDungeonBossRoom = false; + } + } else { + switch (Utils.tabLocation) { + case "Hub": + if (ToggleCommand.hubMusic) hub.start(); + break; + case "Private World": + if (ToggleCommand.islandMusic) island.start(); + break; + case "Dungeon Hub": + if (ToggleCommand.dungeonHubMusic) dungeonHub.start(); + break; + case "The Farming Islands": + if (ToggleCommand.farmingIslandsMusic) farmingIslands.start(); + break; + case "Gold Mine": + if (ToggleCommand.goldMineMusic) goldMine.start(); + break; + case "Deep Caverns": + if (ToggleCommand.deepCavernsMusic) deepCaverns.start(); + break; + case "Dwarven Mines": + if (ToggleCommand.dwarvenMinesMusic) dwarvenMines.start(); + break; + case "Crystal Hollows": + if (ToggleCommand.crystalHollowsMusic) crystalHollows.start(); + break; + case "Blazing Fortress": + if (ToggleCommand.blazingFortressMusic) blazingFortress.start(); + break; + case "The End": + if (ToggleCommand.endMusic) end.start(); + break; + case "The Park": + if (ToggleCommand.parkMusic) park.start(); + break; } } } @@ -118,12 +179,34 @@ public class CustomMusic { dungeonboss = new Song(directory, "dungeonboss", dungeonbossVolume); bloodroom = new Song(directory, "bloodroom", bloodroomVolume); dungeon = new Song(directory, "dungeon", dungeonVolume); + hub = new Song(directory, "hub", hubVolume); + island = new Song(directory, "island", hubVolume); + dungeonHub = new Song(directory, "dungeonhub", dungeonHubVolume); + farmingIslands = new Song(directory, "farmingislands", farmingIslandsVolume); + goldMine = new Song(directory, "goldmine", goldMineVolume); + deepCaverns = new Song(directory, "deepcaverns", deepCavernsVolume); + dwarvenMines = new Song(directory, "dwarvenmines", dwarvenMinesVolume); + crystalHollows = new Song(directory, "crystalhollows", crystalHollowsVolume); + blazingFortress = new Song(directory, "blazingfortress", blazingFortressVolume); + end = new Song(directory, "end", endVolume); + park = new Song(directory, "park", parkVolume); } public static void reset() { if (dungeonboss != null) dungeonboss.stop(); if (bloodroom != null) bloodroom.stop(); if (dungeon != null) dungeon.stop(); + if (hub != null) hub.stop(); + if (island != null) island.stop(); + if (dungeonHub != null) dungeonHub.stop(); + if (farmingIslands != null) farmingIslands.stop(); + if (goldMine != null) goldMine.stop(); + if (deepCaverns != null) deepCaverns.stop(); + if (dwarvenMines != null) dwarvenMines.stop(); + if (crystalHollows != null) crystalHollows.stop(); + if (blazingFortress != null) blazingFortress.stop(); + if (end != null) end.stop(); + if (park != null) park.stop(); } public static class Song { @@ -153,8 +236,8 @@ public class CustomMusic { } public void start() { - reset(); - if (music != null) { + if (music != null && !music.isRunning()) { + reset(); shuffle(); cancelNotes = true; music.setMicrosecondPosition(0); @@ -183,9 +266,7 @@ public class CustomMusic { float decibels = (float) (20 * Math.log(volume / 100.0)); for (Clip music : playlist) { FloatControl control = (FloatControl) music.getControl(FloatControl.Type.MASTER_GAIN); - if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) { - return false; - } + if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) return false; control.setValue(decibels); } diff --git a/src/main/java/me/Danker/gui/CustomMusicGui.java b/src/main/java/me/Danker/gui/CustomMusicGui.java index 505bf34..3e634bf 100644 --- a/src/main/java/me/Danker/gui/CustomMusicGui.java +++ b/src/main/java/me/Danker/gui/CustomMusicGui.java @@ -12,11 +12,30 @@ import net.minecraft.client.gui.ScaledResolution; public class CustomMusicGui extends GuiScreen { + private int page; + private GuiButton goBack; + private GuiButton backPage; + private GuiButton nextPage; private GuiButton dungeonBossMusic; private GuiButton bloodRoomMusic; private GuiButton dungeonMusic; + private GuiButton hubMusic; + private GuiButton islandMusic; + private GuiButton dungeonHubMusic; + private GuiButton farmingIslandsMusic; + private GuiButton goldMineMusic; + private GuiButton deepCavernsMusic; + private GuiButton dwarvenMinesMusic; + private GuiButton crystalHollowsMusic; + private GuiButton blazingFortressMusic; + private GuiButton endMusic; + private GuiButton parkMusic; + + public CustomMusicGui(int page) { + this.page = page; + } @Override public boolean doesGuiPauseGame() { @@ -32,13 +51,47 @@ public class CustomMusicGui extends GuiScreen { int width = sr.getScaledWidth(); goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back"); + nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); + 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)); + hubMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Custom Hub Music: " + Utils.getColouredBoolean(ToggleCommand.hubMusic)); + islandMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Custom Island Music: " + Utils.getColouredBoolean(ToggleCommand.islandMusic)); + dungeonHubMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Custom Dungeon Hub Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonHubMusic)); + farmingIslandsMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Custom Farming Islands Music: " + Utils.getColouredBoolean(ToggleCommand.farmingIslandsMusic)); + goldMineMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Custom Gold Mine Music: " + Utils.getColouredBoolean(ToggleCommand.goldMineMusic)); + deepCavernsMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Custom Deep Caverns Music: " + Utils.getColouredBoolean(ToggleCommand.deepCavernsMusic)); + dwarvenMinesMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Custom Dwarven Mines Music: " + Utils.getColouredBoolean(ToggleCommand.dwarvenMinesMusic)); + crystalHollowsMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Custom Crystal Hollows Music: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowsMusic)); + blazingFortressMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Custom Blazing Fortress Music: " + Utils.getColouredBoolean(ToggleCommand.blazingFortressMusic)); + endMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Custom End Music: " + Utils.getColouredBoolean(ToggleCommand.endMusic)); + parkMusic = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Custom Park Music: " + Utils.getColouredBoolean(ToggleCommand.parkMusic)); + + switch (page) { + case 1: + this.buttonList.add(dungeonMusic); + this.buttonList.add(bloodRoomMusic); + this.buttonList.add(dungeonBossMusic); + this.buttonList.add(hubMusic); + this.buttonList.add(islandMusic); + this.buttonList.add(dungeonHubMusic); + this.buttonList.add(farmingIslandsMusic); + this.buttonList.add(nextPage); + break; + case 2: + this.buttonList.add(goldMineMusic); + this.buttonList.add(deepCavernsMusic); + this.buttonList.add(dwarvenMinesMusic); + this.buttonList.add(crystalHollowsMusic); + this.buttonList.add(blazingFortressMusic); + this.buttonList.add(endMusic); + this.buttonList.add(parkMusic); + this.buttonList.add(backPage); + break; + } - this.buttonList.add(dungeonMusic); - this.buttonList.add(bloodRoomMusic); - this.buttonList.add(dungeonBossMusic); this.buttonList.add(goBack); } @@ -52,6 +105,10 @@ public class CustomMusicGui extends GuiScreen { public void actionPerformed(GuiButton button) { if (button == goBack) { DankersSkyblockMod.guiToOpen = "dankergui1"; + } else if (button == backPage) { + Minecraft.getMinecraft().displayGuiScreen(new CustomMusicGui(page - 1)); + } else if (button == nextPage) { + Minecraft.getMinecraft().displayGuiScreen(new CustomMusicGui(page + 1)); } else if (button == dungeonBossMusic) { ToggleCommand.dungeonBossMusic = !ToggleCommand.dungeonBossMusic; CustomMusic.dungeonboss.stop(); @@ -67,6 +124,61 @@ public class CustomMusicGui extends GuiScreen { CustomMusic.dungeon.stop(); ConfigHandler.writeBooleanConfig("toggles", "DungeonMusic", ToggleCommand.dungeonMusic); dungeonMusic.displayString = "Custom Dungeon Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonMusic); + } else if (button == hubMusic) { + ToggleCommand.hubMusic = !ToggleCommand.hubMusic; + CustomMusic.hub.stop(); + ConfigHandler.writeBooleanConfig("toggles", "HubMusic", ToggleCommand.hubMusic); + hubMusic.displayString = "Custom Hub Music: " + Utils.getColouredBoolean(ToggleCommand.hubMusic); + } else if (button == islandMusic) { + ToggleCommand.islandMusic = !ToggleCommand.islandMusic; + CustomMusic.island.stop(); + ConfigHandler.writeBooleanConfig("toggles", "IslandMusic", ToggleCommand.islandMusic); + islandMusic.displayString = "Custom Island Music: " + Utils.getColouredBoolean(ToggleCommand.islandMusic); + } else if (button == dungeonHubMusic) { + ToggleCommand.dungeonHubMusic = !ToggleCommand.dungeonHubMusic; + CustomMusic.dungeonHub.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DungeonHubMusic", ToggleCommand.dungeonHubMusic); + dungeonHubMusic.displayString = "Custom Dungeon Hub Music: " + Utils.getColouredBoolean(ToggleCommand.dungeonHubMusic); + } else if (button == farmingIslandsMusic) { + ToggleCommand.farmingIslandsMusic = !ToggleCommand.farmingIslandsMusic; + CustomMusic.farmingIslands.stop(); + ConfigHandler.writeBooleanConfig("toggles", "FarmingIslandsMusic", ToggleCommand.farmingIslandsMusic); + farmingIslandsMusic.displayString = "Custom Farming Islands Music: " + Utils.getColouredBoolean(ToggleCommand.farmingIslandsMusic); + } else if (button == goldMineMusic) { + ToggleCommand.goldMineMusic = !ToggleCommand.goldMineMusic; + CustomMusic.goldMine.stop(); + ConfigHandler.writeBooleanConfig("toggles", "GoldMineMusic", ToggleCommand.goldMineMusic); + goldMineMusic.displayString = "Custom Gold Mine Music: " + Utils.getColouredBoolean(ToggleCommand.goldMineMusic); + } else if (button == deepCavernsMusic) { + ToggleCommand.deepCavernsMusic = !ToggleCommand.deepCavernsMusic; + CustomMusic.deepCaverns.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DeepCavernsMusic", ToggleCommand.deepCavernsMusic); + deepCavernsMusic.displayString = "Custom Deep Caverns Music: " + Utils.getColouredBoolean(ToggleCommand.deepCavernsMusic); + } else if (button == dwarvenMinesMusic) { + ToggleCommand.dwarvenMinesMusic = !ToggleCommand.dwarvenMinesMusic; + CustomMusic.dwarvenMines.stop(); + ConfigHandler.writeBooleanConfig("toggles", "DwarvenMinesMusic", ToggleCommand.dwarvenMinesMusic); + dwarvenMinesMusic.displayString = "Custom Dwarven Mines Music: " + Utils.getColouredBoolean(ToggleCommand.dwarvenMinesMusic); + } else if (button == crystalHollowsMusic) { + ToggleCommand.crystalHollowsMusic = !ToggleCommand.crystalHollowsMusic; + CustomMusic.crystalHollows.stop(); + ConfigHandler.writeBooleanConfig("toggles", "CrystalHollowsMusic", ToggleCommand.crystalHollowsMusic); + crystalHollowsMusic.displayString = "Custom Crystal Hollows Music: " + Utils.getColouredBoolean(ToggleCommand.crystalHollowsMusic); + } else if (button == blazingFortressMusic) { + ToggleCommand.blazingFortressMusic = !ToggleCommand.blazingFortressMusic; + CustomMusic.blazingFortress.stop(); + ConfigHandler.writeBooleanConfig("toggles", "BlazingFortressMusic", ToggleCommand.blazingFortressMusic); + blazingFortressMusic.displayString = "Custom Blazing Fortress Music: " + Utils.getColouredBoolean(ToggleCommand.blazingFortressMusic); + } else if (button == endMusic) { + ToggleCommand.endMusic = !ToggleCommand.endMusic; + CustomMusic.end.stop(); + ConfigHandler.writeBooleanConfig("toggles", "EndMusic", ToggleCommand.endMusic); + endMusic.displayString = "Custom End Music: " + Utils.getColouredBoolean(ToggleCommand.endMusic); + } else if (button == parkMusic) { + ToggleCommand.parkMusic = !ToggleCommand.parkMusic; + CustomMusic.park.stop(); + ConfigHandler.writeBooleanConfig("toggles", "ParkMusic", ToggleCommand.parkMusic); + parkMusic.displayString = "Custom Park Music: " + Utils.getColouredBoolean(ToggleCommand.parkMusic); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 115f01b..cfee6b2 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -262,10 +262,32 @@ public class ConfigHandler { ToggleCommand.dungeonBossMusic = initBoolean("toggles", "DungeonBossMusic", false); ToggleCommand.bloodRoomMusic = initBoolean("toggles", "BloodRoomMusic", false); ToggleCommand.dungeonMusic = initBoolean("toggles", "DungeonMusic", false); + ToggleCommand.hubMusic = initBoolean("toggles", "HubMusic", false); + ToggleCommand.islandMusic = initBoolean("toggles", "IslandMusic", false); + ToggleCommand.dungeonHubMusic = initBoolean("toggles", "DungeonHubMusic", false); + ToggleCommand.farmingIslandsMusic = initBoolean("toggles", "FarmingIslandsMusic", false); + ToggleCommand.goldMineMusic = initBoolean("toggles", "GoldMineMusic", false); + ToggleCommand.deepCavernsMusic = initBoolean("toggles", "DeepCavernsMusic", false); + ToggleCommand.dwarvenMinesMusic = initBoolean("toggles", "DwarvenMinesMusic", false); + ToggleCommand.crystalHollowsMusic = initBoolean("toggles", "CrystalHollowsMusic", false); + ToggleCommand.blazingFortressMusic = initBoolean("toggles", "BlazingFortressMusic", false); + ToggleCommand.endMusic = initBoolean("toggles", "Music", false); + ToggleCommand.parkMusic = initBoolean("toggles", "Music", false); // Music Volume CustomMusic.dungeonbossVolume = initInt("music", "DungeonBossVolume", 50); CustomMusic.bloodroomVolume = initInt("music", "BloodRoomVolume", 50); CustomMusic.dungeonVolume = initInt("music", "DungeonVolume", 50); + CustomMusic.hubVolume = initInt("music", "HubVolume", 50); + CustomMusic.islandVolume = initInt("music", "IslandVolume", 50); + CustomMusic.dungeonHubVolume = initInt("music", "DungeonHubVolume", 50); + CustomMusic.farmingIslandsVolume = initInt("music", "FarmingIslandsVolume", 50); + CustomMusic.goldMineVolume = initInt("music", "GoldMineVolume", 50); + CustomMusic.deepCavernsVolume = initInt("music", "DeepCavernsVolume", 50); + CustomMusic.dwarvenMinesVolume = initInt("music", "DwarvenMinesVolume", 50); + CustomMusic.crystalHollowsVolume = initInt("music", "CrystalHollowsVolume", 50); + CustomMusic.blazingFortressVolume = initInt("music", "BlazingFortressVolume", 50); + CustomMusic.endVolume = initInt("music", "EndVolume", 50); + CustomMusic.parkVolume = initInt("music", "ParkVolume", 50); // API if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index dd6eed5..c1e76d7 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -40,7 +40,7 @@ public class Utils { public static boolean inSkyblock = false; public static boolean inDungeons = false; - public static boolean inCrystalHollows = false; + public static String tabLocation = ""; public static int[] skillXPPerLevel = {0, 50, 125, 200, 300, 500, 750, 1000, 1500, 2000, 3500, 5000, 7500, 10000, 15000, 20000, 30000, 50000, 75000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, @@ -170,18 +170,19 @@ public class Utils { inDungeons = false; } - public static void checkForCrystalHollows() { - if (inSkyblock) { + public static void checkTabLocation() { + if (inSkyblock) { Collection<NetworkPlayerInfo> players = Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap(); for (NetworkPlayerInfo player : players) { if (player == null || player.getDisplayName() == null) continue; - if (player.getDisplayName().getUnformattedText().contains("Crystal Hollows")) { - inCrystalHollows = true; + String text = player.getDisplayName().getUnformattedText(); + if (text.startsWith("Area: ")) { + tabLocation = text.substring(text.indexOf(":") + 2); return; } } } - inCrystalHollows = false; + tabLocation = ""; } public static boolean isInScoreboard(String text) { |