diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-08-09 20:32:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 20:32:25 -0400 |
commit | 4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b (patch) | |
tree | 7f762c94a742a07e5c3939e70d35cf7128071b32 /src/main/java/me | |
parent | 48253eddf00cf5d94ecc2eb6b63e7c490b3145be (diff) | |
parent | f56302bee3939677fc3fd015a97b12b5100c45b1 (diff) | |
download | SkyblockMod-4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b.tar.gz SkyblockMod-4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b.tar.bz2 SkyblockMod-4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b.zip |
Merge branch 'development' into development
Diffstat (limited to 'src/main/java/me')
31 files changed, 904 insertions, 88 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 4338242..73c996b 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3,9 +3,7 @@ package me.Danker; import com.google.gson.JsonObject; import me.Danker.commands.*; import me.Danker.commands.warp.WarpCommandHandler; -import me.Danker.events.ChestSlotClickedEvent; -import me.Danker.events.GuiChestBackgroundDrawnEvent; -import me.Danker.events.RenderOverlayEvent; +import me.Danker.events.*; import me.Danker.features.*; import me.Danker.features.loot.*; import me.Danker.features.puzzlesolvers.*; @@ -65,7 +63,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.7-beta6"; + public static final String VERSION = "1.8.7-beta7"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; @@ -130,6 +128,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); MinecraftForge.EVENT_BUS.register(new FirePillarDisplay()); + MinecraftForge.EVENT_BUS.register(new FishingSpawnAlerts()); MinecraftForge.EVENT_BUS.register(new GemstonesLore()); MinecraftForge.EVENT_BUS.register(new GiantHPDisplay()); MinecraftForge.EVENT_BUS.register(new GoldenEnchants()); @@ -142,6 +141,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new IceWalkSolver()); MinecraftForge.EVENT_BUS.register(new LividSolver()); MinecraftForge.EVENT_BUS.register(new LowHealthNotifications()); + MinecraftForge.EVENT_BUS.register(new MinionLastCollected()); MinecraftForge.EVENT_BUS.register(new NecronNotifications()); MinecraftForge.EVENT_BUS.register(new NoF3Coords()); MinecraftForge.EVENT_BUS.register(new NotifySlayerSlain()); @@ -177,17 +177,13 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new GhostTracker()); MinecraftForge.EVENT_BUS.register(new MythologicalTracker()); MinecraftForge.EVENT_BUS.register(new SpiderTracker()); + MinecraftForge.EVENT_BUS.register(new TrophyFishTracker()); MinecraftForge.EVENT_BUS.register(new WolfTracker()); MinecraftForge.EVENT_BUS.register(new ZombieTracker()); - - Alerts.configFile = configDirectory + "/dsmalerts.json"; - ChatAliases.configFile = configDirectory + "/dsmaliases.json"; - + + MinecraftForge.EVENT_BUS.post(new ModInitEvent(configDirectory)); ConfigHandler.reloadConfig(); - GoldenEnchants.init(); - TriviaSolver.init(); - CustomMusic.init(configDirectory); - GemstonesLore.init(); + MinecraftForge.EVENT_BUS.post(new PostConfigInitEvent(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"); diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 21ada93..c340ed8 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological/ghost/auto/off> [winter/festival/spooky/ch/lava/session/f(1-7)/mm]"; + return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological/ghost/auto/off> [winter/festival/spooky/ch/lava/trophy/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -132,6 +132,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "fishing_lava"; } break; + case "trophy": + if (showSession) { + LootDisplay.display = "fishing_trophy_session"; + } else { + LootDisplay.display = "fishing_trophy"; + } + break; default: if (showSession) { LootDisplay.display = "fishing_session"; diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 46d9906..6658bcd 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -3,6 +3,7 @@ package me.Danker.commands; import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.FishingTracker; +import me.Danker.features.loot.TrophyFishTracker; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; @@ -63,7 +64,9 @@ public class ImportFishingCommand extends CommandBase { } System.out.println("Fetching fishing stats..."); - JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject(); + JsonObject memberObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); + JsonObject statsObject = memberObject.get("stats").getAsJsonObject(); + JsonObject trophyObject = memberObject.get("trophy_fish").getAsJsonObject(); FishingTracker.greatCatches = 0; FishingTracker.goodCatches = 0; @@ -123,7 +126,7 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.thunders = getSCFromApi(statsObject, "kills_thunder"); FishingTracker.lordJawbuses = getSCFromApi(statsObject, "kills_lord_jawbus"); - System.out.println("Writing to config..."); + System.out.println("Writing SC to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); ConfigHandler.writeIntConfig("fishing", "greatCatch", FishingTracker.greatCatches); ConfigHandler.writeIntConfig("fishing", "seaCreature", FishingTracker.seaCreatures); @@ -172,6 +175,27 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "thunder", FishingTracker.thunders); ConfigHandler.writeIntConfig("fishing", "lordJawbus", FishingTracker.lordJawbuses); + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fish.add("Sulpher Skitter", getTrophyFromAPI(trophyObject, "sulphur_skitter")); + TrophyFishTracker.fish.add("Obfuscated 1", getTrophyFromAPI(trophyObject, "obfuscated_fish_1")); + TrophyFishTracker.fish.add("Steaming-Hot Flounder", getTrophyFromAPI(trophyObject, "steaming_hot_flounder")); + TrophyFishTracker.fish.add("Obfuscated 2", getTrophyFromAPI(trophyObject, "obfuscated_fish_2")); + TrophyFishTracker.fish.add("Gusher", getTrophyFromAPI(trophyObject, "gusher")); + TrophyFishTracker.fish.add("Blobfish", getTrophyFromAPI(trophyObject, "blobfish")); + TrophyFishTracker.fish.add("Slugfish", getTrophyFromAPI(trophyObject, "slugfish")); + TrophyFishTracker.fish.add("Obfuscated 3", getTrophyFromAPI(trophyObject, "obfuscated_fish_3")); + TrophyFishTracker.fish.add("Flyfish", getTrophyFromAPI(trophyObject, "flyfish")); + TrophyFishTracker.fish.add("Lavahorse", getTrophyFromAPI(trophyObject, "lava_horse")); + TrophyFishTracker.fish.add("Mana Ray", getTrophyFromAPI(trophyObject, "mana_ray")); + TrophyFishTracker.fish.add("Volcanic Stonefish", getTrophyFromAPI(trophyObject, "volcanic_stonefish")); + TrophyFishTracker.fish.add("Vanille", getTrophyFromAPI(trophyObject, "vanille")); + TrophyFishTracker.fish.add("Skeleton Fish", getTrophyFromAPI(trophyObject, "skeleton_fish")); + TrophyFishTracker.fish.add("Moldfin", getTrophyFromAPI(trophyObject, "moldfin")); + TrophyFishTracker.fish.add("Soul Fish", getTrophyFromAPI(trophyObject, "soul_fish")); + TrophyFishTracker.fish.add("Karate Fish", getTrophyFromAPI(trophyObject, "karate_fish")); + TrophyFishTracker.fish.add("Golden Fish", getTrophyFromAPI(trophyObject, "golden_fish")); + TrophyFishTracker.save(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } @@ -183,4 +207,15 @@ public class ImportFishingCommand extends CommandBase { return sc; } + static JsonObject getTrophyFromAPI(JsonObject obj, String name) { + JsonObject tiers = new JsonObject(); + + tiers.addProperty("BRONZE", obj.has(name + "_bronze") ? obj.get(name + "_bronze").getAsInt() : 0); + tiers.addProperty("SILVER", obj.has(name + "_silver") ? obj.get(name + "_silver").getAsInt() : 0); + tiers.addProperty("GOLD", obj.has(name + "_gold") ? obj.get(name + "_gold").getAsInt() : 0); + tiers.addProperty("DIAMOND", obj.has(name + "_diamond") ? obj.get(name + "_diamond").getAsInt() : 0); + + return tiers; + } + } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index af5479e..3c224bb 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological> [winter/festival/spooky/ch/lava/f(1-7)/mm/session]"; + return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological> [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +41,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -621,6 +621,54 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Creatures Since Lord Jawbus: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; + } else if (arg1[1].equalsIgnoreCase("trophy")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary (Current Session):\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary:\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 9256394..00cf8f6 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -289,10 +289,14 @@ public class ResetLootCommand extends CommandBase { FishingTracker.taurusesSession = 0; FishingTracker.thundersSession = 0; FishingTracker.lordJawbusesSession = 0; - FishingTracker.jawbusTimeSession = 0; - FishingTracker.jawbusSCsSession = 0; + FishingTracker.jawbusTimeSession = -1; + FishingTracker.jawbusSCsSession = -1; ConfigHandler.deleteCategory("fishing"); ConfigHandler.reloadConfig(); + + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fishSession = TrophyFishTracker.createEmpty(); + TrophyFishTracker.save(); } static void resetMythological() { diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index f17c79d..be3cf3c 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -9,14 +9,20 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.HoverEvent; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; +import java.text.NumberFormat; import java.util.List; +import java.util.Locale; public class SkillsCommand extends CommandBase { - + + static NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + @Override public String getCommandName() { return "skill"; @@ -85,7 +91,17 @@ public class SkillsCommand extends CommandBase { System.out.println("Fetching skills..."); JsonObject userObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); - + + ChatComponentText farmingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Farming: "); + ChatComponentText miningLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Mining: "); + ChatComponentText combatLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Combat: "); + ChatComponentText foragingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Foraging: "); + ChatComponentText fishingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Fishing: "); + ChatComponentText enchantingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Enchanting: "); + ChatComponentText alchemyLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Alchemy: "); + ChatComponentText tamingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Taming: "); + ChatComponentText newLine = new ChatComponentText("\n"); + double farmingLevel = 0; double miningLevel = 0; double combatLevel = 0; @@ -94,39 +110,55 @@ public class SkillsCommand extends CommandBase { double enchantingLevel = 0; double alchemyLevel = 0; double tamingLevel = 0; - + if (userObject.has("experience_skill_farming") || userObject.has("experience_skill_mining") || userObject.has("experience_skill_combat") || userObject.has("experience_skill_foraging") || userObject.has("experience_skill_fishing") || userObject.has("experience_skill_enchanting") || userObject.has("experience_skill_alchemy")) { if (userObject.has("experience_skill_farming")) { farmingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_farming").getAsDouble(), 60); farmingLevel = (double) Math.round(farmingLevel * 100) / 100; + farmingLevelText.setChatStyle(appendFormatted(farmingLevelText, "XP", userObject.get("experience_skill_farming").getAsDouble())); + farmingLevelText.setChatStyle(appendFormatted(farmingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_farming").getAsDouble(), 60))); } if (userObject.has("experience_skill_mining")) { miningLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_mining").getAsDouble(), 60); miningLevel = (double) Math.round(miningLevel * 100) / 100; + miningLevelText.setChatStyle(appendFormatted(miningLevelText, "XP", userObject.get("experience_skill_mining").getAsDouble())); + miningLevelText.setChatStyle(appendFormatted(miningLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_mining").getAsDouble(), 60))); } if (userObject.has("experience_skill_combat")) { combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble(), 60); combatLevel = (double) Math.round(combatLevel * 100) / 100; + combatLevelText.setChatStyle(appendFormatted(combatLevelText, "XP", userObject.get("experience_skill_combat").getAsDouble())); + combatLevelText.setChatStyle(appendFormatted(combatLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_combat").getAsDouble(), 60))); } if (userObject.has("experience_skill_foraging")) { foragingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_foraging").getAsDouble(), 50); foragingLevel = (double) Math.round(foragingLevel * 100) / 100; + foragingLevelText.setChatStyle(appendFormatted(foragingLevelText, "XP", userObject.get("experience_skill_foraging").getAsDouble())); + foragingLevelText.setChatStyle(appendFormatted(foragingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_foraging").getAsDouble(), 50))); } if (userObject.has("experience_skill_fishing")) { fishingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_fishing").getAsDouble(), 50); fishingLevel = (double) Math.round(fishingLevel * 100) / 100; + fishingLevelText.setChatStyle(appendFormatted(fishingLevelText, "XP", userObject.get("experience_skill_fishing").getAsDouble())); + fishingLevelText.setChatStyle(appendFormatted(fishingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_fishing").getAsDouble(), 50))); } if (userObject.has("experience_skill_enchanting")) { enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble(), 60); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; + enchantingLevelText.setChatStyle(appendFormatted(enchantingLevelText, "XP", userObject.get("experience_skill_enchanting").getAsDouble())); + enchantingLevelText.setChatStyle(appendFormatted(enchantingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_enchanting").getAsDouble(), 60))); } if (userObject.has("experience_skill_alchemy")) { alchemyLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_alchemy").getAsDouble(), 50); alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; + alchemyLevelText.setChatStyle(appendFormatted(alchemyLevelText, "XP", userObject.get("experience_skill_alchemy").getAsDouble())); + alchemyLevelText.setChatStyle(appendFormatted(alchemyLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_alchemy").getAsDouble(), 50))); } if (userObject.has("experience_skill_taming")) { tamingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_taming").getAsDouble(), 50); tamingLevel = (double) Math.round(tamingLevel * 100) / 100; + tamingLevelText.setChatStyle(appendFormatted(tamingLevelText, "XP", userObject.get("experience_skill_taming").getAsDouble())); + tamingLevelText.setChatStyle(appendFormatted(tamingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_taming").getAsDouble(), 50))); } } else { // Get skills from achievement API, will be floored @@ -144,48 +176,82 @@ public class SkillsCommand extends CommandBase { JsonObject achievementObject = playerObject.get("player").getAsJsonObject().get("achievements").getAsJsonObject(); if (achievementObject.has("skyblock_harvester")) { farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); + farmingLevelText.setChatStyle(appendFormatted(farmingLevelText, "XP", Utils.skillLevelToXp((int) farmingLevel))); } if (achievementObject.has("skyblock_excavator")) { miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); + miningLevelText.setChatStyle(appendFormatted(miningLevelText, "XP", Utils.skillLevelToXp((int) miningLevel))); } if (achievementObject.has("skyblock_combat")) { combatLevel = achievementObject.get("skyblock_combat").getAsInt(); + combatLevelText.setChatStyle(appendFormatted(combatLevelText, "XP", Utils.skillLevelToXp((int) combatLevel))); } if (achievementObject.has("skyblock_gatherer")) { foragingLevel = Math.min(achievementObject.get("skyblock_gatherer").getAsInt(), 50); + foragingLevelText.setChatStyle(appendFormatted(foragingLevelText, "XP", Utils.skillLevelToXp((int) foragingLevel))); } if (achievementObject.has("skyblock_angler")) { fishingLevel = Math.min(achievementObject.get("skyblock_angler").getAsInt(), 50); + fishingLevelText.setChatStyle(appendFormatted(fishingLevelText, "XP", Utils.skillLevelToXp((int) fishingLevel))); } if (achievementObject.has("skyblock_augmentation")) { enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); + enchantingLevelText.setChatStyle(appendFormatted(enchantingLevelText, "XP", Utils.skillLevelToXp((int) enchantingLevel))); } if (achievementObject.has("skyblock_concoctor")) { alchemyLevel = Math.min(achievementObject.get("skyblock_concoctor").getAsInt(), 50); + alchemyLevelText.setChatStyle(appendFormatted(alchemyLevelText, "XP", Utils.skillLevelToXp((int) alchemyLevel))); } if (achievementObject.has("skyblock_domesticator")) { tamingLevel = Math.min(achievementObject.get("skyblock_domesticator").getAsInt(), 50); + tamingLevelText.setChatStyle(appendFormatted(tamingLevelText, "XP", Utils.skillLevelToXp((int) tamingLevel))); } } + farmingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel)); + miningLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel)); + combatLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel)); + foragingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel)); + fishingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel)); + enchantingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel)); + alchemyLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel)); + tamingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel)); + double skillAvg = (farmingLevel + miningLevel + combatLevel + foragingLevel + fishingLevel + enchantingLevel + alchemyLevel + tamingLevel) / 8; skillAvg = (double) Math.round(skillAvg * 100) / 100; double trueAvg = (Math.floor(farmingLevel) + Math.floor(miningLevel) + Math.floor(combatLevel) + Math.floor(foragingLevel) + Math.floor(fishingLevel) + Math.floor(enchantingLevel) + Math.floor(alchemyLevel) + Math.floor(tamingLevel)) / 8; player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + - EnumChatFormatting.AQUA + " " + username + "'s Skills:\n" + - DankersSkyblockMod.TYPE_COLOUR + " Farming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Mining: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Combat: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Foraging: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Fishing: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Enchanting: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Alchemy: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Taming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel + "\n" + + EnumChatFormatting.AQUA + " " + username + "'s Skills:\n") + .appendSibling(farmingLevelText).appendSibling(newLine) + .appendSibling(miningLevelText).appendSibling(newLine) + .appendSibling(combatLevelText).appendSibling(newLine) + .appendSibling(foragingLevelText).appendSibling(newLine) + .appendSibling(fishingLevelText).appendSibling(newLine) + .appendSibling(enchantingLevelText).appendSibling(newLine) + .appendSibling(alchemyLevelText).appendSibling(newLine) + .appendSibling(tamingLevelText).appendSibling(newLine) + .appendSibling(new ChatComponentText( EnumChatFormatting.AQUA + " Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + skillAvg + "\n" + EnumChatFormatting.AQUA + " True Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + trueAvg + "\n" + - DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------"))); }).start(); } + static ChatStyle appendHover(ChatComponentText component, String text) { + String original = ""; + if (component.getChatStyle().getChatHoverEvent() != null) original = component.getChatStyle().getChatHoverEvent().getValue().getFormattedText(); + if (original.length() > 0) original += "\n"; + return component.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(original + text))); + } + + static ChatStyle appendFormatted(ChatComponentText component, String category, double number) { + return appendHover(component, DankersSkyblockMod.TYPE_COLOUR + category + ": " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(number)); + } + + static double getOverflowXP(double xp, int limit) { + if (limit == 50) return Math.max(0D, xp - 55172425D); + return Math.max(0D, xp - 111672425D); + } + } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 2009e1c..00b41f3 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -50,6 +50,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean hidePetCandy; public static boolean highlightCommissions; public static boolean customColouredNames; + public static boolean customNametags; public static boolean endOfFarmAlert; public static boolean gemstoneLore; public static boolean crystalHollowWaypoints; @@ -63,6 +64,9 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean autoJoinSkyblock; public static boolean firePillar; public static boolean aliases; + public static boolean fishingAlert; + public static boolean minionLastCollected; + public static boolean showTrophyCompletion; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; diff --git a/src/main/java/me/Danker/events/ModInitEvent.java b/src/main/java/me/Danker/events/ModInitEvent.java new file mode 100644 index 0000000..e1cc644 --- /dev/null +++ b/src/main/java/me/Danker/events/ModInitEvent.java @@ -0,0 +1,13 @@ +package me.Danker.events; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class ModInitEvent extends Event { + + public final String configDirectory; + + public ModInitEvent(String configDirectory) { + this.configDirectory = configDirectory; + } + +} diff --git a/src/main/java/me/Danker/events/PostConfigInitEvent.java b/src/main/java/me/Danker/events/PostConfigInitEvent.java new file mode 100644 index 0000000..3e58456 --- /dev/null +++ b/src/main/java/me/Danker/events/PostConfigInitEvent.java @@ -0,0 +1,13 @@ +package me.Danker.events; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class PostConfigInitEvent extends Event { + + public final String configDirectory; + + public PostConfigInitEvent(String configDirectory) { + this.configDirectory = configDirectory; + } + +} diff --git a/src/main/java/me/Danker/features/Alerts.java b/src/main/java/me/Danker/features/Alerts.java index 8f45423..aa6197f 100644 --- a/src/main/java/me/Danker/features/Alerts.java +++ b/src/main/java/me/Danker/features/Alerts.java @@ -1,8 +1,8 @@ package me.Danker.features; import com.google.gson.GsonBuilder; -import javafx.scene.control.Alert; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; @@ -25,6 +25,11 @@ public class Alerts { public static String configFile; @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmalerts.json"; + } + + @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { if (!ToggleCommand.alerts || event.type == 2) return; diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 7f86035..9ef3b4d 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -97,6 +97,8 @@ public class AutoDisplay { if (lore.get(j).contains("FISHING ROD")) { if (Utils.tabLocation.equals("Crimson Isle")) { LootDisplay.display = "fishing_lava"; + } else if (Utils.tabLocation.equals("Jerry's Workshop")) { + LootDisplay.display = "fishing_winter"; } else { LootDisplay.display = "fishing"; } diff --git a/src/main/java/me/Danker/features/ChatAliases.java b/src/main/java/me/Danker/features/ChatAliases.java index ae9e0f7..76ab5f6 100644 --- a/src/main/java/me/Danker/features/ChatAliases.java +++ b/src/main/java/me/Danker/features/ChatAliases.java @@ -1,6 +1,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; +import me.Danker.events.ModInitEvent; import me.Danker.events.PacketWriteEvent; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C01PacketChatMessage; @@ -17,6 +18,11 @@ public class ChatAliases { public static String configFile; @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmaliases.json"; + } + + @SubscribeEvent public void onPacketWrite(PacketWriteEvent event) { if (event.packet instanceof C01PacketChatMessage) { C01PacketChatMessage packet = (C01PacketChatMessage) event.packet; diff --git a/src/main/java/me/Danker/features/ColouredNames.java b/src/main/java/me/Danker/features/ColouredNames.java index 90d722e..9f7890c 100644 --- a/src/main/java/me/Danker/features/ColouredNames.java +++ b/src/main/java/me/Danker/features/ColouredNames.java @@ -72,7 +72,7 @@ public class ColouredNames { @SubscribeEvent(priority = EventPriority.LOW) public void onRenderLiving(RenderLivingEvent.Specials.Pre<EntityLivingBase> event) { - if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return; + if (!ToggleCommand.customColouredNames || !ToggleCommand.customNametags || !Utils.inSkyblock) return; Entity entity = event.entity; if (entity instanceof EntityArmorStand && !entity.isDead && entity.hasCustomName()) { diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java index a8ee0f9..12aa94e 100644 --- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -7,7 +7,6 @@ import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; @@ -148,7 +147,7 @@ public class CrystalHollowWaypoints { } player.addChatMessage(new ChatComponentText("\n" + DankersSkyblockMod.MAIN_COLOUR + "DSM/SBE Crystal Hollows waypoints found. Click to add.\n").appendSibling(add)); }).start(); - } else { + } else if (message.indexOf(":") != message.lastIndexOf(":")) { String text = message.substring(message.indexOf(":") + 2); Matcher matcher = skytilsPattern.matcher(text); diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 3ea8d1f..38e4ba0 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -2,6 +2,8 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; +import me.Danker.events.PostConfigInitEvent; import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; @@ -67,6 +69,7 @@ public class CustomMusic { public static Song park; public static int parkVolume; + static int curPhase = 0; @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -94,9 +97,29 @@ public class CustomMusic { firstLine.contains("30,344") || // F4 firstLine.contains("livid") || // F5 firstLine.contains("sadan") || // F6 - firstLine.contains("maxor")) { // F7 - - if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); + firstLine.contains("maxor") || // F7 + firstLine.contains("f7")) { + + if (ToggleCommand.dungeonBossMusic) { + switch (curPhase) { + case -1: + break; + case 2: + phase2.start(); + break; + case 3: + phase3.start(); + break; + case 4: + phase4.start(); + break; + case 5: + phase5.start(); + break; + default: + dungeonboss.start(); + } + } } } } else { @@ -153,22 +176,27 @@ public class CustomMusic { } } - if (message.contains(":")) return; - if (Utils.inDungeons) { if (ToggleCommand.dungeonBossMusic) { - if (message.startsWith("[BOSS] Storm: Pathetic Maxor")) { + if (phase2.hasSongs() && message.startsWith("[BOSS] Storm: Pathetic Maxor")) { phase2.start(); - } else if (message.startsWith("[BOSS] Goldor: Who dares trespass into my domain?")) { + curPhase = 2; + } else if (phase3.hasSongs() && message.startsWith("[BOSS] Goldor: Who dares trespass into my domain?")) { phase3.start(); - } else if (message.startsWith("[BOSS] Necron: You went further than any human before")) { + curPhase = 3; + } else if (phase4.hasSongs() && message.startsWith("[BOSS] Necron: You went further than any human before")) { phase4.start(); - } else if (message.startsWith("[BOSS] ") && message.endsWith("You.. again?")) { + curPhase = 4; + } else if (phase5.hasSongs() && message.startsWith("[BOSS] ") && message.endsWith("You.. again?")) { phase5.start(); + curPhase = 5; } } + if (message.contains(":")) return; + if (message.contains("EXTRA STATS ")) { + curPhase = -1; // force no play dungeonboss.stop(); bloodroom.stop(); dungeon.stop(); @@ -190,6 +218,11 @@ public class CustomMusic { } } + @SubscribeEvent + public void postConfigInit(PostConfigInitEvent event) { + init(event.configDirectory); + } + public static void init(String configDirectory) { if (configDirectory == null) return; File directory = new File(configDirectory + "/dsmmusic"); @@ -205,7 +238,7 @@ public class CustomMusic { phase4 = new Song(directory, "phasefour", phase4Volume); phase5 = new Song(directory, "phasefive", phase5Volume); hub = new Song(directory, "hub", hubVolume); - island = new Song(directory, "island", hubVolume); + island = new Song(directory, "island", islandVolume); dungeonHub = new Song(directory, "dungeonhub", dungeonHubVolume); farmingIslands = new Song(directory, "farmingislands", farmingIslandsVolume); goldMine = new Song(directory, "goldmine", goldMineVolume); @@ -238,6 +271,7 @@ public class CustomMusic { if (crimsonIsle != null) crimsonIsle.stop(); if (end != null) end.stop(); if (park != null) park.stop(); + curPhase = 0; } public static class Song { @@ -263,6 +297,7 @@ public class CustomMusic { public void start() throws UnsupportedAudioFileException, LineUnavailableException, IOException { try { + if (music == null) music = AudioSystem.getClip(); if (!music.isRunning()) { reset(); shuffle(); @@ -307,14 +342,20 @@ public class CustomMusic { 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()) return false; - control.setValue(decibels); + if (music != null) { + 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()) return false; + control.setValue(decibels); + } return true; } + public boolean hasSongs() { + return playlist.size() > 0; + } + } } diff --git a/src/main/java/me/Danker/features/FishingSpawnAlerts.java b/src/main/java/me/Danker/features/FishingSpawnAlerts.java new file mode 100644 index 0000000..3f11dfc --- /dev/null +++ b/src/main/java/me/Danker/features/FishingSpawnAlerts.java @@ -0,0 +1,60 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class FishingSpawnAlerts { + + static boolean lastThunder = false; + static boolean lastJawbus = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 10 == 0) { + if (ToggleCommand.fishingAlert && Utils.tabLocation.equals("Crimson Isle") && world != null) { + boolean thunder = false; + boolean jawbus = false; + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + if (entity instanceof EntityArmorStand) { + String name = StringUtils.stripControlCodes(entity.getName()); + if (name.contains("Thunder")) { + thunder = true; + } else if (name.contains("Lord Jawbus")) { + jawbus = true; + } + } + } + + if (thunder && !lastThunder) Utils.createTitle(EnumChatFormatting.AQUA + "THUNDER", 2); + if (jawbus && !lastJawbus) Utils.createTitle(EnumChatFormatting.AQUA + "JAWBUS", 2); + + lastThunder = thunder; + lastJawbus = jawbus; + } + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + lastThunder = false; + lastJawbus = false; + } + +} diff --git a/src/main/java/me/Danker/features/GemstonesLore.java b/src/main/java/me/Danker/features/GemstonesLore.java index c633c58..b16edaf 100644 --- a/src/main/java/me/Danker/features/GemstonesLore.java +++ b/src/main/java/me/Danker/features/GemstonesLore.java @@ -1,6 +1,7 @@ package me.Danker.features; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; @@ -18,7 +19,8 @@ public class GemstonesLore { static Map<String, EnumChatFormatting> gemstoneColours = new HashMap<>(); - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { gemstoneColours.put("Amber", EnumChatFormatting.GOLD); gemstoneColours.put("Sapphire", EnumChatFormatting.AQUA); gemstoneColours.put("Jasper", EnumChatFormatting.LIGHT_PURPLE); @@ -26,6 +28,7 @@ public class GemstonesLore { gemstoneColours.put("Topaz", EnumChatFormatting.YELLOW); gemstoneColours.put("Jade", EnumChatFormatting.GREEN); gemstoneColours.put("Ruby", EnumChatFormatting.RED); + gemstoneColours.put("Opal", EnumChatFormatting.WHITE); } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/src/main/java/me/Danker/features/GoldenEnchants.java b/src/main/java/me/Danker/features/GoldenEnchants.java index d633ec5..228d43e 100644 --- a/src/main/java/me/Danker/features/GoldenEnchants.java +++ b/src/main/java/me/Danker/features/GoldenEnchants.java @@ -1,6 +1,7 @@ package me.Danker.features; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -15,7 +16,8 @@ public class GoldenEnchants { public static Map<String, String> t6Enchants = new HashMap<>(); public static Pattern t6EnchantPattern = Pattern.compile(""); - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { t6Enchants.put("9Angler VI", "6Angler VI"); t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); t6Enchants.put("9Caster VI", "6Caster VI"); diff --git a/src/main/java/me/Danker/features/MinionLastCollected.java b/src/main/java/me/Danker/features/MinionLastCollected.java new file mode 100644 index 0000000..d793970 --- /dev/null +++ b/src/main/java/me/Danker/features/MinionLastCollected.java @@ -0,0 +1,142 @@ +package me.Danker.features; + +import com.google.gson.GsonBuilder; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.events.ModInitEvent; +import me.Danker.events.PacketWriteEvent; +import me.Danker.utils.RenderUtils; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class MinionLastCollected { + + public static List<Minion> minions = new ArrayList<>(); + public static String configFile; + static BlockPos lastMinion = null; + public static int LAST_COLLECTED_COLOUR; + + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmminions.json"; + } + + @SubscribeEvent + public void onPacketWrite(PacketWriteEvent event) { + if (ToggleCommand.minionLastCollected && Utils.inSkyblock && Utils.isInScoreboard("Your Island")) { + if (event.packet instanceof C02PacketUseEntity) { + C02PacketUseEntity packet = (C02PacketUseEntity) event.packet; + Entity entity = packet.getEntityFromWorld(Minecraft.getMinecraft().theWorld); + if (isAMinion(entity)) { + lastMinion = entity.getPosition(); + if (getMinionFromPos(lastMinion) == null) { + minions.add(new Minion(lastMinion)); + save(); + } + } + } + } + } + + @SubscribeEvent + public void onSlotClick(ChestSlotClickedEvent event) { + if (ToggleCommand.minionLastCollected && Utils.tabLocation.equals("Private Island")) { + String inventoryName = event.inventoryName; + ItemStack item = event.item; + if (inventoryName.contains(" Minion ") && item != null && lastMinion != null) { + if (item.getDisplayName().contains("Collect All")) { + getMinionFromPos(lastMinion).collectNow(); + save(); + } else if (item.getDisplayName().contains("Pickup Minion")) { + minions.remove(getMinionFromPos(lastMinion)); + save(); + } + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.minionLastCollected && Utils.inSkyblock && Utils.tabLocation.equals("Private Island")) { + for (Minion minion : minions) { + if (!minionExistsAtPos(minion.pos)) continue; + RenderUtils.draw3DString(minion.pos.getX() + 0.5, minion.pos.getY() + 2.2, minion.pos.getZ() + 0.5, minion.getTimeCollected(), LAST_COLLECTED_COLOUR, event.partialTicks); + } + } + } + + public boolean isAMinion(Entity entity) { + if (!(entity instanceof EntityArmorStand)) return false; + EntityArmorStand armourStand = (EntityArmorStand) entity; + + for (int i = 0; i <= 3; i++) { + if (armourStand.getCurrentArmor(i) == null) return false; + } + + return (Item.getIdFromItem(armourStand.getCurrentArmor(0).getItem()) == 301 && + Item.getIdFromItem(armourStand.getCurrentArmor(1).getItem()) == 300 && + Item.getIdFromItem(armourStand.getCurrentArmor(2).getItem()) == 299 && + Item.getIdFromItem(armourStand.getCurrentArmor(3).getItem()) == 397); + } + + public Minion getMinionFromPos(BlockPos pos) { + for (Minion minion : minions) { + if (minion.pos.equals(pos)) return minion; + } + return null; + } + + public boolean minionExistsAtPos(BlockPos pos) { + AxisAlignedBB aabb = new AxisAlignedBB(pos, pos.add(1, 1, 1)); + List<EntityArmorStand> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityArmorStand.class, aabb); + return entities.size() > 0; // just assume theres a minion there + } + + public static void save() { + try (FileWriter writer = new FileWriter(configFile)) { + new GsonBuilder().create().toJson(minions, writer); + writer.flush(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static class Minion { + + public BlockPos pos; + public double lastCollect; + + public Minion(BlockPos pos) { + this.pos = pos; + this.lastCollect = -1; + } + + public String getTimeCollected() { + String lastCollected = "Last Collected: "; + if (lastCollect == -1) { + return lastCollected + "Never"; + } + return lastCollected + Utils.getTimeBetween(lastCollect, System.currentTimeMillis() / 1000) + " ago"; + } + + public void collectNow() { + lastCollect = System.currentTimeMillis() / 1000; + } + + } + +} diff --git a/src/main/java/me/Danker/features/loot/FishingTracker.java b/src/main/java/me/Danker/features/loot/FishingTracker.java index f8adfa2..1690793 100644 --- a/src/main/java/me/Danker/features/loot/FishingTracker.java +++ b/src/main/java/me/Danker/features/loot/FishingTracker.java @@ -125,8 +125,8 @@ public class FishingTracker { public static int taurusesSession = 0; public static int thundersSession = 0; public static int lordJawbusesSession = 0; - public static double jawbusTimeSession = 0; - public static int jawbusSCsSession = 0; + public static double jawbusTimeSession = -1; + public static int jawbusSCsSession = -1; @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { @@ -174,7 +174,7 @@ public class FishingTracker { seaArchersSession++; ConfigHandler.writeIntConfig("fishing", "seaArcher", seaArchers); increaseSeaCreatures(); - } else if (message.contains("The Monster of the Deep has emerged")) { + } else if (message.contains("The Rider of the Deep has emerged")) { monsterOfTheDeeps++; monsterOfTheDeepsSession++; ConfigHandler.writeIntConfig("fishing", "monsterOfDeep", monsterOfTheDeeps); diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 7832362..fe68c3e 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -946,6 +946,124 @@ public class LootDisplay { EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; + case "fishing_trophy": + dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + + EnumChatFormatting.WHITE + "Obfuscated 1:\n" + + EnumChatFormatting.WHITE + "Steaminghot Flounder:\n" + + EnumChatFormatting.WHITE + "Gusher:\n" + + EnumChatFormatting.WHITE + "Blobfish:\n" + + EnumChatFormatting.GREEN + "Obfuscated 2:\n" + + EnumChatFormatting.GREEN + "Slugfish:\n" + + EnumChatFormatting.GREEN + "Flyfish:\n" + + EnumChatFormatting.BLUE + "Obfuscated 3:\n" + + EnumChatFormatting.BLUE + "Lavahorse:\n" + + EnumChatFormatting.BLUE + "Mana Ray:\n" + + EnumChatFormatting.BLUE + "Volcanic Stonefish:\n" + + EnumChatFormatting.BLUE + "Vanille:\n" + + EnumChatFormatting.DARK_PURPLE + "Skeleton Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Moldfin:\n" + + EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + + EnumChatFormatting.GOLD + "Golden Fish:"; + if (!ToggleCommand.showTrophyCompletion) countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish"); + + if (ToggleCommand.showTrophyCompletion) { + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Sulpher Skitter", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 1", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Steaming-Hot Flounder", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (2 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Gusher", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (3 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Blobfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (4 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 2", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (5 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Slugfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (6 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Flyfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (7 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 3", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (8 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Lavahorse", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (9 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Mana Ray", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (10 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Volcanic Stonefish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (11 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Vanille", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (12 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Skeleton Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (13 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Moldfin", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (14 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Soul Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (15 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Karate Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (16 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Golden Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (17 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + } + break; + case "fishing_trophy_session": + dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + + EnumChatFormatting.WHITE + "Obfuscated 1:\n" + + EnumChatFormatting.WHITE + "Steaminghot Flounder:\n" + + EnumChatFormatting.WHITE + "Gusher:\n" + + EnumChatFormatting.WHITE + "Blobfish:\n" + + EnumChatFormatting.GREEN + "Obfuscated 2:\n" + + EnumChatFormatting.GREEN + "Slugfish:\n" + + EnumChatFormatting.GREEN + "Flyfish:\n" + + EnumChatFormatting.BLUE + "Obfuscated 3:\n" + + EnumChatFormatting.BLUE + "Lavahorse:\n" + + EnumChatFormatting.BLUE + "Mana Ray:\n" + + EnumChatFormatting.BLUE + "Volcanic Stonefish:\n" + + EnumChatFormatting.BLUE + "Vanille:\n" + + EnumChatFormatting.DARK_PURPLE + "Skeleton Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Moldfin:\n" + + EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + + EnumChatFormatting.GOLD + "Golden Fish:"; + if (!ToggleCommand.showTrophyCompletion) countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish"); + + if (ToggleCommand.showTrophyCompletion) { + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Sulpher Skitter", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 1", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Steaming-Hot Flounder", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (2 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Gusher", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (3 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Blobfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (4 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 2", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (5 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Slugfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (6 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Flyfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (7 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 3", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (8 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Lavahorse", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (9 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Mana Ray", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (10 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Volcanic Stonefish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (11 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Vanille", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (12 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Skeleton Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (13 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Moldfin", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (14 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Soul Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (15 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Karate Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (16 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Golden Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (17 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + } + break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java index 7fa223d..13599a0 100644 --- a/src/main/java/me/Danker/features/loot/LootTracker.java +++ b/src/main/java/me/Danker/features/loot/LootTracker.java @@ -1,13 +1,11 @@ package me.Danker.features.loot; +import me.Danker.events.PacketReadEvent; import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.Utils; -import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraft.network.play.server.S29PacketSoundEffect; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -16,20 +14,17 @@ public class LootTracker { public static long itemsChecked = 0; static Pattern dropPattern = Pattern.compile(".*? \\((?<amount>\\d+)x .*\\).*"); - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onSound(PlaySoundEvent event) { + @SubscribeEvent + public void onPacketRead(PacketReadEvent event) { if (!Utils.inSkyblock) return; - if (event.name.equals("note.pling")) { - // Don't check twice within 3 seconds - long checkItemsNow = System.currentTimeMillis() / 1000; - if (checkItemsNow - itemsChecked < 3) return; - List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + if (event.packet instanceof S29PacketSoundEffect) { + S29PacketSoundEffect packet = (S29PacketSoundEffect) event.packet; - for (String line : scoreboard) { - String cleanedLine = ScoreboardHandler.cleanSB(line); - // If Hypixel lags and scoreboard doesn't update - if (cleanedLine.contains("Boss slain!") || cleanedLine.contains("Slay the boss!")) { + if (packet.getSoundName().equals("note.pling")) { + if (System.currentTimeMillis() / 1000 - itemsChecked < 3) return; + + if (Utils.isInScoreboard("Boss slain!") || Utils.isInScoreboard("Slay the boss!")) { int itemTeeth = Utils.getItems("Wolf Tooth"); int itemWebs = Utils.getItems("Tarantula Web"); int itemRev = Utils.getItems("Revenant Flesh"); diff --git a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java new file mode 100644 index 0000000..6202871 --- /dev/null +++ b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java @@ -0,0 +1,143 @@ +package me.Danker.features.loot; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import me.Danker.events.ModInitEvent; +import me.Danker.utils.RenderUtils; +import me.Danker.utils.Utils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TrophyFishTracker { + + public static JsonObject fish = new JsonObject(); + public static JsonObject fishSession = new JsonObject(); + public static Pattern fishPattern = Pattern.compile("TROPHY FISH! You caught a (?<fish>.*) (?<tier>.*)."); + public static String configFile; + + public static JsonObject createEmpty() { + JsonObject fish = new JsonObject(); + + JsonObject tiers = new JsonObject(); + tiers.addProperty("BRONZE", 0); + tiers.addProperty("SILVER", 0); + tiers.addProperty("GOLD", 0); + tiers.addProperty("DIAMOND", 0); + + fish.add("Sulpher Skitter", Utils.deepCopy(tiers)); + fish.add("Obfuscated 1", Utils.deepCopy(tiers)); + fish.add("Steaming-Hot Flounder", Utils.deepCopy(tiers)); + fish.add("Obfuscated 2", Utils.deepCopy(tiers)); + fish.add("Gusher", Utils.deepCopy(tiers)); + fish.add("Blobfish", Utils.deepCopy(tiers)); + fish.add("Slugfish", Utils.deepCopy(tiers)); + fish.add("Obfuscated 3", Utils.deepCopy(tiers)); + fish.add("Flyfish", Utils.deepCopy(tiers)); + fish.add("Lavahorse", Utils.deepCopy(tiers)); + fish.add("Mana Ray", Utils.deepCopy(tiers)); + fish.add("Volcanic Stonefish", Utils.deepCopy(tiers)); + fish.add("Vanille", Utils.deepCopy(tiers)); + fish.add("Skeleton Fish", Utils.deepCopy(tiers)); + fish.add("Moldfin", Utils.deepCopy(tiers)); + fish.add("Soul Fish", Utils.deepCopy(tiers)); + fish.add("Karate Fish", Utils.deepCopy(tiers)); + fish.add("Golden Fish", Utils.deepCopy(tiers)); + + return fish; + } + + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmtrophyfish.json"; + if (fish.entrySet().isEmpty()) fish = createEmpty(); + fishSession = createEmpty(); + } + + @SubscribeEvent(receiveCanceled = true) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (!Utils.tabLocation.equals("Crimson Isle")) return; + if (event.type == 2) return; + if (message.contains(":")) return; + + Matcher matcher = fishPattern.matcher(message); + + if (matcher.matches()) { + String fishName = matcher.group("fish"); + String tier = matcher.group("tier"); + + JsonObject fishObj = fish.get(fishName).getAsJsonObject(); + int amount = fishObj.get(tier).getAsInt(); + fishObj.addProperty(tier, amount + 1); + + JsonObject fishSessionObj = fishSession.get(fishName).getAsJsonObject(); + int amountSession = fishSessionObj.get(tier).getAsInt(); + fishSessionObj.addProperty(tier, amountSession + 1); + + save(); + } + } + + public static void save() { + try (FileWriter writer = new FileWriter(configFile)) { + new GsonBuilder().create().toJson(fish, writer); + writer.flush(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static String getTierCount(JsonObject obj, String name) { + JsonObject type = obj.get(name).getAsJsonObject(); + + int bronze = type.get("BRONZE").getAsInt(); + int silver = type.get("SILVER").getAsInt(); + int gold = type.get("GOLD").getAsInt(); + int diamond = type.get("DIAMOND").getAsInt(); + + return EnumChatFormatting.DARK_GRAY + "" + bronze + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.GRAY + silver + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.GOLD + gold + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.AQUA + diamond; + } + + public static int getSum(JsonObject obj, String name) { + JsonObject type = obj.get(name).getAsJsonObject(); + return type.get("BRONZE").getAsInt() + + type.get("SILVER").getAsInt() + + type.get("GOLD").getAsInt() + + type.get("DIAMOND").getAsInt(); + } + + public static void drawCompletion(JsonObject obj, String name, int x, int y, double scale) { + JsonObject type = obj.get(name).getAsJsonObject(); + + boolean bronze = type.get("BRONZE").getAsInt() > 0; + boolean silver = type.get("SILVER").getAsInt() > 0; + boolean gold = type.get("GOLD").getAsInt() > 0; + boolean diamond = type.get("DIAMOND").getAsInt() > 0; + + ItemStack incomplete = new ItemStack(Items.dye, 1, 8); + ItemStack bronzeComplete = new ItemStack(Items.brick); + ItemStack silverComplete = new ItemStack(Items.iron_ingot); + ItemStack goldComplete = new ItemStack(Items.gold_ingot); + ItemStack diamondComplete = new ItemStack(Items.diamond); + + RenderUtils.renderItem(bronze ? bronzeComplete : incomplete, x, y - 2, scale / 1.3D); + RenderUtils.renderItem(silver ? silverComplete : incomplete, x + 15, y - 2, scale / 1.3D); + RenderUtils.renderItem(gold ? goldComplete : incomplete, x + 30, y - 2, scale / 1.3D); + RenderUtils.renderItem(diamond ? diamondComplete : incomplete, x + 45, y - 2, scale / 1.3D); + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index dd2c23e..23d0228 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -5,6 +5,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; @@ -26,7 +27,8 @@ public class TriviaSolver { static JsonArray triviaAnswersJson = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { // Hard coded solutions if api call fails triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); @@ -39,11 +41,12 @@ public class TriviaSolver { triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"227 Fairy Souls"}); + triviaSolutions.put("What is the status of Maxor, Storm, Goldor and Necron?", new String[]{"Wither Lord"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"238 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Crimson Isle?", new String[]{"29 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); @@ -57,7 +60,7 @@ public class TriviaSolver { triviaSolutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); triviaSolutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); - triviaSolutions.put("How many unique minions are there?", new String[]{"53 Minions"}); + triviaSolutions.put("How many unique minions are there?", new String[]{"55 Minions"}); triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", "Dashing Spooder", "Broodfather", "Night Spider"}); triviaSolutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index f4319a8..06c50d0 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -76,6 +76,7 @@ public class DankerGui extends GuiScreen { private GuiButton hidePetCandy; private GuiButton highlightCommissions; private GuiButton customColouredNames; + private GuiButton customNametags; private GuiButton endOfFarmAlert; private GuiButton gemstoneLore; private GuiButton autoAcceptReparty; @@ -92,6 +93,9 @@ public class DankerGui extends GuiScreen { private GuiButton hideArmour; private GuiButton autoJoinSkyblock; private GuiButton firePillar; + private GuiButton fishingAlert; + private GuiButton minionLastCollected; + private GuiButton showTrophyCompletion; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -179,6 +183,7 @@ public class DankerGui extends GuiScreen { hidePetCandy = new FeatureButton("Hide Pet Candy: " + Utils.getColouredBoolean(ToggleCommand.hidePetCandy), "Hide pet candy in pet tooltips."); highlightCommissions = new FeatureButton("Highlight Commissions: " + Utils.getColouredBoolean(ToggleCommand.highlightCommissions), "Show which commissions are completed."); customColouredNames = new FeatureButton("Custom Name Colors: " + Utils.getColouredBoolean(ToggleCommand.customColouredNames), "Replaces some player's usernames with a custom color."); + customNametags = new FeatureButton("Custom Color on Nametags: " + Utils.getColouredBoolean(ToggleCommand.customNametags), "Displays custom name colors on nametags. Disabling will increase performance with custom colors."); endOfFarmAlert = new FeatureButton("Alert When Reaching End of Farm: " + Utils.getColouredBoolean(ToggleCommand.endOfFarmAlert), "Alerts when you go past coords set with /dsmfarmlength."); gemstoneLore = new FeatureButton("Applied Gemstones in Lore: " + Utils.getColouredBoolean(ToggleCommand.gemstoneLore), "Adds applied gemstones to item tooltip."); autoAcceptReparty = new FeatureButton("Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty), "Automatically rejoins parties when disbanded and invited."); @@ -187,6 +192,9 @@ public class DankerGui extends GuiScreen { hideArmour = new FeatureButton("Hide Player Armour: " + Utils.getColouredBoolean(ToggleCommand.hideArmour), "Makes player armour invisible, showing their skin."); autoJoinSkyblock = new FeatureButton("Automatically Join Skyblock: " + Utils.getColouredBoolean(ToggleCommand.autoJoinSkyblock), "Automatically join Skyblock when you join Hypixel.\nYou have an addiction."); firePillar = new FeatureButton("Fire Pillar Display: " + Utils.getColouredBoolean(ToggleCommand.firePillar), "Displays blaze fire pillar text on screen"); + fishingAlert = new FeatureButton("Fishing Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.fishingAlert), "Alerts when a Thunder or Lord Jawbus spawns nearby"); + minionLastCollected = new FeatureButton("Show When Minion Last Collected: " + Utils.getColouredBoolean(ToggleCommand.minionLastCollected), "Displays when a minion was last collected over the minion."); + showTrophyCompletion = new FeatureButton("Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion), "Show completion instead of count in trophy fish tracker display."); allButtons.clear(); allButtons.add(changeDisplay); @@ -240,6 +248,7 @@ public class DankerGui extends GuiScreen { allButtons.add(hidePetCandy); allButtons.add(highlightCommissions); allButtons.add(customColouredNames); + allButtons.add(customNametags); allButtons.add(endOfFarmAlert); allButtons.add(gemstoneLore); allButtons.add(autoAcceptReparty); @@ -248,6 +257,9 @@ public class DankerGui extends GuiScreen { allButtons.add(hideArmour); allButtons.add(autoJoinSkyblock); allButtons.add(firePillar); + allButtons.add(fishingAlert); + allButtons.add(minionLastCollected); + allButtons.add(showTrophyCompletion); search.setText(initSearchText); search.setVisible(true); @@ -545,6 +557,22 @@ public class DankerGui extends GuiScreen { ToggleCommand.firePillar = !ToggleCommand.firePillar; ConfigHandler.writeBooleanConfig("toggles", "FirePillar", ToggleCommand.firePillar); firePillar.displayString = "Fire Pillar Display: " + Utils.getColouredBoolean(ToggleCommand.firePillar); + } else if (button == fishingAlert) { + ToggleCommand.fishingAlert = !ToggleCommand.fishingAlert; + ConfigHandler.writeBooleanConfig("toggles", "FishingAlert", ToggleCommand.fishingAlert); + fishingAlert.displayString = "Fishing Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.fishingAlert); + } else if (button == customNametags) { + ToggleCommand.customNametags = !ToggleCommand.customNametags; + ConfigHandler.writeBooleanConfig("toggles", "CustomNametags", ToggleCommand.customNametags); + customNametags.displayString = "Custom Color on Nametags: " + Utils.getColouredBoolean(ToggleCommand.customNametags); + } else if (button == minionLastCollected) { + ToggleCommand.minionLastCollected = !ToggleCommand.minionLastCollected; + ConfigHandler.writeBooleanConfig("toggles", "MinionLastCollected", ToggleCommand.minionLastCollected); + minionLastCollected.displayString = "Show When Minion Last Collected: " + Utils.getColouredBoolean(ToggleCommand.minionLastCollected); + } else if (button == showTrophyCompletion) { + ToggleCommand.showTrophyCompletion = !ToggleCommand.showTrophyCompletion; + ConfigHandler.writeBooleanConfig("toggles", "ShowTrophyCompletion", ToggleCommand.showTrophyCompletion); + showTrophyCompletion.displayString = "Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion); } } diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index b8be3d6..f7fd2f3 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -28,6 +28,7 @@ public class DisplayGui extends GuiScreen { private GuiButton fishingSpooky; private GuiButton fishingCH; private GuiButton fishingLava; + private GuiButton fishingTrophy; private GuiButton catacombsF1; private GuiButton catacombsF2; private GuiButton catacombsF3; @@ -61,12 +62,13 @@ public class DisplayGui extends GuiScreen { wolf = new GuiButton(0, width / 2 - 50, (int) (height * 0.35), 100, 20, "Wolf"); enderman = new GuiButton(0, width / 2 + 60, (int) (height * 0.35), 100, 20, "Enderman"); blaze = new GuiButton(0, width / 2 + 170, (int) (height * 0.35), 100, 20, "Blaze"); - fishing = new GuiButton(0, width / 2 - 295, (int) (height * 0.5), 90, 20, "Fishing"); - fishingWinter = new GuiButton(0, width / 2 - 195, (int) (height * 0.5), 90, 20, "Fishing Winter"); - fishingFestival = new GuiButton(0, width / 2 - 95, (int) (height * 0.5), 90, 20, "Fishing Festival"); - fishingSpooky = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 90, 20, "Fishing Spooky"); - fishingCH = new GuiButton(0, width / 2 + 105, (int) (height * 0.5), 90, 20, "CH Fishing"); - fishingLava = new GuiButton(0, width / 2 + 205, (int) (height * 0.5), 90, 20, "Lava Fishing"); + fishing = new GuiButton(0, width / 2 - 310, (int) (height * 0.5), 80, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 220, (int) (height * 0.5), 80, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 - 130, (int) (height * 0.5), 80, 20, "Fishing Festival"); + fishingSpooky = new GuiButton(0, width / 2 - 40, (int) (height * 0.5), 80, 20, "Fishing Spooky"); + fishingCH = new GuiButton(0, width / 2 + 50, (int) (height * 0.5), 80, 20, "CH Fishing"); + fishingLava = new GuiButton(0, width / 2 + 140, (int) (height * 0.5), 80, 20, "Lava Fishing"); + fishingTrophy = new GuiButton(0, width / 2 + 230, (int) (height * 0.5), 80, 20, "Fishing Trophy"); catacombsF1 = new GuiButton(0, width / 2 - 235, (int) (height * 0.65), 50, 20, "F1"); catacombsF2 = new GuiButton(0, width / 2 - 175, (int) (height * 0.65), 50, 20, "F2"); catacombsF3 = new GuiButton(0, width / 2 - 115, (int) (height * 0.65), 50, 20, "F3"); @@ -92,6 +94,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(fishingSpooky); this.buttonList.add(fishingCH); this.buttonList.add(fishingLava); + this.buttonList.add(fishingTrophy); this.buttonList.add(catacombsF1); this.buttonList.add(catacombsF2); this.buttonList.add(catacombsF3); @@ -153,6 +156,8 @@ public class DisplayGui extends GuiScreen { setDisplay("fishing_ch"); } else if (button == fishingLava) { setDisplay("fishing_lava"); + } else if (button == fishingTrophy) { + setDisplay("fishing_trophy"); } else if (button == mythological) { setDisplay("mythological"); } else if (button == catacombsF1) { diff --git a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java index 4853ac1..02c3d3b 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java @@ -1,7 +1,6 @@ package me.Danker.gui.alerts; import me.Danker.features.Alerts; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4880041..edbd0b4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -2,6 +2,8 @@ package me.Danker.handlers; import com.google.gson.Gson; import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -224,6 +226,7 @@ public class ConfigHandler { ToggleCommand.giantHP = initBoolean("toggles", "GiantHP", false); ToggleCommand.hidePetCandy = initBoolean("toggles", "HidePetCandy", false); ToggleCommand.customColouredNames = initBoolean("toggles", "CustomColouredNames", true); // enabled by default + ToggleCommand.customNametags = initBoolean("toggles", "CustomNametags", true); ToggleCommand.endOfFarmAlert = initBoolean("toggles", "EndOfFarmAlert", false); ToggleCommand.gemstoneLore = initBoolean("toggles", "GemstoneLore", false); ToggleCommand.crystalHollowWaypoints = initBoolean("toggles", "CrystalHollowWaypoints", false); @@ -248,6 +251,9 @@ public class ConfigHandler { ToggleCommand.autoJoinSkyblock = initBoolean("toggles", "AutoJoinSkyblock", false); ToggleCommand.firePillar = initBoolean("toggles", "FirePillar", false); ToggleCommand.aliases = initBoolean("toggles", "Aliases", false); + ToggleCommand.fishingAlert = initBoolean("toggles", "FishingAlert", false); + ToggleCommand.minionLastCollected = initBoolean("toggles", "MinionLastCollected", false); + ToggleCommand.showTrophyCompletion = initBoolean("toggles", "ShowTrophyCompletion", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); @@ -714,6 +720,7 @@ public class ConfigHandler { SilverfishSolver.SILVERFISH_LINE_COLOUR = initInt("colors", "silverfishLine", 0x40FF40); IceWalkSolver.ICE_WALK_LINE_COLOUR = initInt("colors", "iceWalkLine", 0x40FF40); HighlightCommissions.HIGHLIGHT_COLOUR = initInt("colors", "highlight_colour", 0x51FF51); + MinionLastCollected.LAST_COLLECTED_COLOUR = initInt("colors", "lastCollected", 0x55FFFF); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); @@ -739,6 +746,23 @@ public class ConfigHandler { } ChatAliases.Alias[] aliases = gson.fromJson(new FileReader(ChatAliases.configFile), ChatAliases.Alias[].class); if (aliases != null) ChatAliases.aliases = new ArrayList<>(Arrays.asList(aliases)); + + // Minions + if (!(new File(MinionLastCollected.configFile).exists())) { + FileWriter file = new FileWriter(MinionLastCollected.configFile); + file.write(new JsonArray().toString()); + file.close(); + } + MinionLastCollected.Minion[] minions = gson.fromJson(new FileReader(MinionLastCollected.configFile), MinionLastCollected.Minion[].class); + if (minions != null) MinionLastCollected.minions = new ArrayList<>(Arrays.asList(minions)); + + // Trophy Fish + if (!(new File(TrophyFishTracker.configFile).exists())) { + FileWriter file = new FileWriter(TrophyFishTracker.configFile); + file.write(new JsonObject().toString()); + file.close(); + } + TrophyFishTracker.fish = new JsonParser().parse(new FileReader(TrophyFishTracker.configFile)).getAsJsonObject(); } catch (IOException ex) { ex.printStackTrace(); } diff --git a/src/main/java/me/Danker/handlers/ScoreboardHandler.java b/src/main/java/me/Danker/handlers/ScoreboardHandler.java index c8bc7c7..b5785e3 100644 --- a/src/main/java/me/Danker/handlers/ScoreboardHandler.java +++ b/src/main/java/me/Danker/handlers/ScoreboardHandler.java @@ -11,6 +11,7 @@ import net.minecraft.util.StringUtils; import java.util.ArrayList; import java.util.Collection; +import java.util.ConcurrentModificationException; import java.util.List; import java.util.stream.Collectors; @@ -38,7 +39,14 @@ public class ScoreboardHandler { ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); if (objective == null) return lines; - Collection<Score> scores = scoreboard.getSortedScores(objective); + Collection<Score> scores; + try { + scores = scoreboard.getSortedScores(objective); + } catch (ConcurrentModificationException ex) { + ex.printStackTrace(); + return new ArrayList<>(); + } + List<Score> list = scores.stream() .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() .startsWith("#")) diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index b5ede19..f334b7a 100644 --- a/src/main/java/me/Danker/utils/RenderUtils.java +++ b/src/main/java/me/Danker/utils/RenderUtils.java @@ -138,6 +138,30 @@ public class RenderUtils { GlStateManager.popMatrix(); } + public static void draw3DString(double x, double y, double z, String text, int colour, float partialTicks) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer player = mc.thePlayer; + double realX = (x - player.lastTickPosX) + ((x - player.posX) - (x - player.lastTickPosX)) * partialTicks; + double realY = (y - player.lastTickPosY) + ((y - player.posY) - (y - player.lastTickPosY)) * partialTicks; + double realZ = (z - player.lastTickPosZ) + ((z - player.posZ) - (z - player.lastTickPosZ)) * partialTicks; + RenderManager renderManager = mc.getRenderManager(); + + float f = 1.6F; + float f1 = 0.016666668F * f; + int width = mc.fontRendererObj.getStringWidth(text) / 2; + GlStateManager.pushMatrix(); + GlStateManager.translate(realX, realY, realZ); + GL11.glNormal3f(0f, 1f, 0f); + GlStateManager.rotate(-renderManager.playerViewY, 0f, 1f, 0f); + GlStateManager.rotate(renderManager.playerViewX, 1f, 0f, 0f); + GlStateManager.scale(-f1, -f1, -f1); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + mc.fontRendererObj.drawString(text, -width, 0, colour); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + // I couldnt get waypoint strings to work so in the end I just copied from NEU // If anyone sees this please help /*public static void draw3DWaypointString(CrystalHollowWaypoints.Waypoint waypoint, float partialTicks) { @@ -363,15 +387,16 @@ public class RenderUtils { GlStateManager.popMatrix(); } - public static void renderItem(ItemStack item, float x, float y, float z) { - + public static void renderItem(ItemStack stack, int x, int y, double scale) { GlStateManager.enableRescaleNormal(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableDepth(); GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, z); - Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(item, 0, 0); + GlStateManager.translate(x, y, 0); + GlStateManager.scale(scale, scale, scale); + //Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(stack, 0, 0); + Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); GlStateManager.popMatrix(); GlStateManager.disableDepth(); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index bc02d9e..deb5018 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,5 +1,7 @@ package me.Danker.utils; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.ColouredNames; import me.Danker.features.GoldenEnchants; @@ -23,8 +25,8 @@ import net.minecraft.util.*; import org.lwjgl.opengl.GL11; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -252,6 +254,16 @@ public class Utils { } return limit; } + + public static int skillLevelToXp(int level) { + int sum = 0; + + for (int i = 1; i <= level; i++) { + sum += skillXPPerLevel[i]; + } + + return sum; + } public static double xpToDungeonsLevel(double xp) { for (int i = 0, xpAdded = 0; i < dungeonsXPPerLevel.length; i++) { @@ -525,6 +537,16 @@ public class Utils { } } + public static JsonObject deepCopy(JsonObject obj) { + JsonObject newObj = new JsonObject(); + + for (Map.Entry<String, JsonElement> entry : obj.entrySet()) { + newObj.add(entry.getKey(), entry.getValue()); + } + + return newObj; + } + public enum DungeonFloor { NONE, E0, |