From 7f71df3d99a2c9b318c0b9de7c4e1577af5c9294 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 30 Apr 2022 13:21:06 -0400 Subject: Fix custom music crash Re-add line I thought was useless --- src/main/java/me/Danker/features/CustomMusic.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 3ea8d1f..717a3ab 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -263,6 +263,7 @@ public class CustomMusic { public void start() throws UnsupportedAudioFileException, LineUnavailableException, IOException { try { + if (music == null) music = AudioSystem.getClip(); if (!music.isRunning()) { reset(); shuffle(); -- cgit From 5f2acec6bce0cfdd0c435982a01f7f6d7b79e8b9 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 30 Apr 2022 21:39:28 -0400 Subject: Add thunder/jawbus spawn alerts --- README.md | 1 + build.gradle | 2 +- src/main/java/me/Danker/DankersSkyblockMod.java | 3 +- .../java/me/Danker/commands/ToggleCommand.java | 1 + .../me/Danker/features/FishingSpawnAlerts.java | 60 ++++++++++++++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 7 +++ .../java/me/Danker/handlers/ConfigHandler.java | 1 + 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 src/main/java/me/Danker/features/FishingSpawnAlerts.java (limited to 'src/main/java/me/Danker/features') diff --git a/README.md b/README.md index 2a316a0..d22f75e 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Discord Server: https://discord.gg/QsEkNQS - Automatically join skyblock - Fire pillar display - Chat aliases +- Thunder/Lord Jawbus spawn alerts
diff --git a/build.gradle b/build.gradle index fe6e801..2d8bebc 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.8.7-beta6" +version = "1.8.7-beta7" group= "me.Danker.DankersSkyblockMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 3eaac50..6e82137 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -64,7 +64,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 = ""; @@ -128,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()); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 6472d23..09b59d9 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -62,6 +62,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean autoJoinSkyblock; public static boolean firePillar; public static boolean aliases; + public static boolean fishingAlert; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; 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 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/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index abf9ffa..9e013b7 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -90,6 +90,7 @@ public class DankerGui extends GuiScreen { private GuiButton hideArmour; private GuiButton autoJoinSkyblock; private GuiButton firePillar; + private GuiButton fishingAlert; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -184,6 +185,7 @@ 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"); allButtons.clear(); allButtons.add(changeDisplay); @@ -244,6 +246,7 @@ public class DankerGui extends GuiScreen { allButtons.add(hideArmour); allButtons.add(autoJoinSkyblock); allButtons.add(firePillar); + allButtons.add(fishingAlert); search.setText(initSearchText); search.setVisible(true); @@ -537,6 +540,10 @@ 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); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4415a8e..48693c8 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -247,6 +247,7 @@ 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); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); -- cgit From 7670b7d3aaa969fae9ac63a76b970aa53c263118 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 4 May 2022 20:02:58 -0400 Subject: Fix error with waypoints --- src/main/java/me/Danker/features/CrystalHollowWaypoints.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java index a8ee0f9..39a71b4 100644 --- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -148,7 +148,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); -- cgit From 5a706f3f139c795ba6b848db4d18c55490dc1788 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 4 May 2022 21:46:12 -0400 Subject: Update monster of the deep message --- src/main/java/me/Danker/features/loot/FishingTracker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/loot/FishingTracker.java b/src/main/java/me/Danker/features/loot/FishingTracker.java index f8adfa2..fb4fdbc 100644 --- a/src/main/java/me/Danker/features/loot/FishingTracker.java +++ b/src/main/java/me/Danker/features/loot/FishingTracker.java @@ -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); -- cgit From b0954c47d499b922ca006a18a4331c8e1ae366b5 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 11 May 2022 19:18:07 -0400 Subject: Add option to disable custom colours on nametags --- src/main/java/me/Danker/commands/ToggleCommand.java | 1 + src/main/java/me/Danker/features/ColouredNames.java | 2 +- src/main/java/me/Danker/gui/DankerGui.java | 7 +++++++ src/main/java/me/Danker/handlers/ConfigHandler.java | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 09b59d9..91584f8 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -49,6 +49,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean giantHP; public static boolean hidePetCandy; public static boolean customColouredNames; + public static boolean customNametags; public static boolean endOfFarmAlert; public static boolean gemstoneLore; public static boolean crystalHollowWaypoints; 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 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/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 9e013b7..663adf5 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -74,6 +74,7 @@ public class DankerGui extends GuiScreen { private GuiButton giantHP; private GuiButton hidePetCandy; private GuiButton customColouredNames; + private GuiButton customNametags; private GuiButton endOfFarmAlert; private GuiButton gemstoneLore; private GuiButton autoAcceptReparty; @@ -177,6 +178,7 @@ public class DankerGui extends GuiScreen { giantHP = new FeatureButton("Display Giant HP: " + Utils.getColouredBoolean(ToggleCommand.giantHP), "Displays health of Sadan's giants during F6 bossfight and F7 blood room."); hidePetCandy = new FeatureButton("Hide Pet Candy: " + Utils.getColouredBoolean(ToggleCommand.hidePetCandy), "Hide pet candy in pet tooltips."); 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."); @@ -238,6 +240,7 @@ public class DankerGui extends GuiScreen { allButtons.add(giantHP); allButtons.add(hidePetCandy); allButtons.add(customColouredNames); + allButtons.add(customNametags); allButtons.add(endOfFarmAlert); allButtons.add(gemstoneLore); allButtons.add(autoAcceptReparty); @@ -544,6 +547,10 @@ public class DankerGui extends GuiScreen { 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); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 48693c8..1f00c9f 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -223,6 +223,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); -- cgit From 7c0cf9b290768c136420cb3b79f1933daa24dbd2 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 11 May 2022 19:20:16 -0400 Subject: Fix jawbus session default values --- src/main/java/me/Danker/commands/ResetLootCommand.java | 4 ++-- src/main/java/me/Danker/features/loot/FishingTracker.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 9256394..9ccef33 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -289,8 +289,8 @@ 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(); } diff --git a/src/main/java/me/Danker/features/loot/FishingTracker.java b/src/main/java/me/Danker/features/loot/FishingTracker.java index fb4fdbc..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) { -- cgit From 28e9921fa38a4a6365b761275dc40bad61db94ca Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 11 May 2022 19:21:29 -0400 Subject: Add winter fishing to auto display --- src/main/java/me/Danker/features/AutoDisplay.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java 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"; } -- cgit From dd5cd8de6de8edfe13d461619ae16f16724f59e5 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 11 May 2022 19:22:00 -0400 Subject: Add opal to gem list --- src/main/java/me/Danker/features/GemstonesLore.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/GemstonesLore.java b/src/main/java/me/Danker/features/GemstonesLore.java index c633c58..7db2d33 100644 --- a/src/main/java/me/Danker/features/GemstonesLore.java +++ b/src/main/java/me/Danker/features/GemstonesLore.java @@ -26,6 +26,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) -- cgit From a40f87f555e01b09e99ab61e83caf8939ad1a8fd Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 16 May 2022 22:17:17 -0400 Subject: Add minion last collected display --- README.md | 1 + src/main/java/me/Danker/DankersSkyblockMod.java | 2 + .../java/me/Danker/commands/ToggleCommand.java | 1 + .../me/Danker/features/MinionLastCollected.java | 128 +++++++++++++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 7 ++ .../java/me/Danker/handlers/ConfigHandler.java | 11 ++ src/main/java/me/Danker/utils/RenderUtils.java | 24 ++++ 7 files changed, 174 insertions(+) create mode 100644 src/main/java/me/Danker/features/MinionLastCollected.java (limited to 'src/main/java/me/Danker/features') diff --git a/README.md b/README.md index d22f75e..98bf434 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Discord Server: https://discord.gg/QsEkNQS - Fire pillar display - Chat aliases - Thunder/Lord Jawbus spawn alerts +- Show when minion was last collected
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 6e82137..a63552c 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -141,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()); @@ -181,6 +182,7 @@ public class DankersSkyblockMod { Alerts.configFile = configDirectory + "/dsmalerts.json"; ChatAliases.configFile = configDirectory + "/dsmaliases.json"; + MinionLastCollected.configFile = configDirectory + "/dsmminions.json"; ConfigHandler.reloadConfig(); GoldenEnchants.init(); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 91584f8..c08d50a 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -64,6 +64,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean firePillar; public static boolean aliases; public static boolean fishingAlert; + public static boolean minionLastCollected; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; 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..884dccf --- /dev/null +++ b/src/main/java/me/Danker/features/MinionLastCollected.java @@ -0,0 +1,128 @@ +package me.Danker.features; + +import com.google.gson.GsonBuilder; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ChestSlotClickedEvent; +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.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 minions = new ArrayList<>(); + public static String configFile; + static BlockPos lastMinion = null; + public static int LAST_COLLECTED_COLOUR; + + @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) { + 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 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/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 663adf5..c247eab 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -92,6 +92,7 @@ public class DankerGui extends GuiScreen { private GuiButton autoJoinSkyblock; private GuiButton firePillar; private GuiButton fishingAlert; + private GuiButton minionLastCollected; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -188,6 +189,7 @@ public class DankerGui extends GuiScreen { 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."); allButtons.clear(); allButtons.add(changeDisplay); @@ -250,6 +252,7 @@ public class DankerGui extends GuiScreen { allButtons.add(autoJoinSkyblock); allButtons.add(firePillar); allButtons.add(fishingAlert); + allButtons.add(minionLastCollected); search.setText(initSearchText); search.setVisible(true); @@ -551,6 +554,10 @@ public class DankerGui extends GuiScreen { 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); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 1f00c9f..bd60639 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -249,6 +249,7 @@ public class ConfigHandler { ToggleCommand.firePillar = initBoolean("toggles", "FirePillar", false); ToggleCommand.aliases = initBoolean("toggles", "Aliases", false); ToggleCommand.fishingAlert = initBoolean("toggles", "FishingAlert", false); + ToggleCommand.minionLastCollected = initBoolean("toggles", "MinionLastCollected", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); @@ -714,6 +715,7 @@ public class ConfigHandler { BoulderSolver.BOULDER_ARROW_COLOUR = initInt("colors", "boulderArrow", 0x006000); SilverfishSolver.SILVERFISH_LINE_COLOUR = initInt("colors", "silverfishLine", 0x40FF40); IceWalkSolver.ICE_WALK_LINE_COLOUR = initInt("colors", "iceWalkLine", 0x40FF40); + MinionLastCollected.LAST_COLLECTED_COLOUR = initInt("colors", "lastCollected", 0x55FFFF); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); @@ -739,6 +741,15 @@ 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)); } catch (IOException ex) { ex.printStackTrace(); } diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index b5ede19..c3efc90 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) { -- cgit From 77370ce777bf41fec125dbdd3d33b94d579191ba Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 3 Aug 2022 22:53:06 -0400 Subject: Fix F7 custom music I hope --- src/main/java/me/Danker/features/CustomMusic.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 717a3ab..8ce8c05 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -67,6 +67,8 @@ public class CustomMusic { public static Song park; public static int parkVolume; + static int curPhase = -1; + @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -96,7 +98,7 @@ public class CustomMusic { firstLine.contains("sadan") || // F6 firstLine.contains("maxor")) { // F7 - if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); + if (ToggleCommand.dungeonBossMusic && curPhase == -1) dungeonboss.start(); } } } else { @@ -159,12 +161,16 @@ public class CustomMusic { if (ToggleCommand.dungeonBossMusic) { if (message.startsWith("[BOSS] Storm: Pathetic Maxor")) { phase2.start(); + curPhase = 2; } else if (message.startsWith("[BOSS] Goldor: Who dares trespass into my domain?")) { phase3.start(); + curPhase = 3; } else if (message.startsWith("[BOSS] Necron: You went further than any human before")) { phase4.start(); + curPhase = 4; } else if (message.startsWith("[BOSS] ") && message.endsWith("You.. again?")) { phase5.start(); + curPhase = 5; } } @@ -238,6 +244,7 @@ public class CustomMusic { if (crimsonIsle != null) crimsonIsle.stop(); if (end != null) end.stop(); if (park != null) park.stop(); + curPhase = -1; } public static class Song { -- cgit From abd656382da708b8cd77df1f4f0a74f2287618c5 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 5 Aug 2022 00:30:35 -0400 Subject: Add trophy fishing tracker Also update trivia answers and add mod init event --- README.md | 6 +- src/main/java/me/Danker/DankersSkyblockMod.java | 11 +- .../java/me/Danker/commands/DisplayCommand.java | 11 +- .../me/Danker/commands/ImportFishingCommand.java | 39 ++++++- src/main/java/me/Danker/commands/LootCommand.java | 52 ++++++++- .../java/me/Danker/commands/ResetLootCommand.java | 4 + src/main/java/me/Danker/events/ModInitEvent.java | 13 +++ src/main/java/me/Danker/features/Alerts.java | 6 ++ src/main/java/me/Danker/features/ChatAliases.java | 6 ++ src/main/java/me/Danker/features/CustomMusic.java | 7 ++ .../java/me/Danker/features/GemstonesLore.java | 4 +- .../java/me/Danker/features/GoldenEnchants.java | 4 +- .../me/Danker/features/MinionLastCollected.java | 6 ++ .../java/me/Danker/features/loot/LootDisplay.java | 76 +++++++++++++ .../me/Danker/features/loot/TrophyFishTracker.java | 120 +++++++++++++++++++++ .../features/puzzlesolvers/TriviaSolver.java | 11 +- src/main/java/me/Danker/gui/DisplayGui.java | 18 ++-- .../java/me/Danker/handlers/ConfigHandler.java | 11 +- src/main/java/me/Danker/utils/Utils.java | 12 +++ 19 files changed, 386 insertions(+), 31 deletions(-) create mode 100644 src/main/java/me/Danker/events/ModInitEvent.java create mode 100644 src/main/java/me/Danker/features/loot/TrophyFishTracker.java (limited to 'src/main/java/me/Danker/features') diff --git a/README.md b/README.md index 98bf434..624989f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Discord Server: https://discord.gg/QsEkNQS - Maddox menu keybind - Block starting other slayer quests - Slayer slain alert -- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing, lava fishing trackers +- Fishing, jerry fishing, fishing festival, spooky fishing, crystal hollows fishing, lava fishing, trophy fishing trackers - Expertise kills in fishing rod lore - Gemstones applied in item lore - Catacombs trackers @@ -87,8 +87,8 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/festival/spooky/ch/lava/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/festival/spooky/ch/lava/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. +- /loot [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index a63552c..6322c33 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import me.Danker.commands.*; import me.Danker.events.ChestSlotClickedEvent; import me.Danker.events.GuiChestBackgroundDrawnEvent; +import me.Danker.events.ModInitEvent; import me.Danker.events.RenderOverlayEvent; import me.Danker.features.*; import me.Danker.features.loot.*; @@ -177,18 +178,12 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new GhostTracker()); MinecraftForge.EVENT_BUS.register(new MythologicalTracker()); MinecraftForge.EVENT_BUS.register(new SpiderTracker()); + MinecraftForge.EVENT_BUS.register(new TrophyFishTracker()); MinecraftForge.EVENT_BUS.register(new WolfTracker()); MinecraftForge.EVENT_BUS.register(new ZombieTracker()); - Alerts.configFile = configDirectory + "/dsmalerts.json"; - ChatAliases.configFile = configDirectory + "/dsmaliases.json"; - MinionLastCollected.configFile = configDirectory + "/dsmminions.json"; - + MinecraftForge.EVENT_BUS.post(new ModInitEvent(configDirectory)); ConfigHandler.reloadConfig(); - GoldenEnchants.init(); - TriviaSolver.init(); - CustomMusic.init(configDirectory); - GemstonesLore.init(); keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); keyBindings[1] = new KeyBinding("Regular Ability", Keyboard.KEY_NUMPAD4, "Danker's Skyblock Mod"); diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 21ada93..c340ed8 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/session/f(1-7)/mm]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/trophy/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -132,6 +132,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "fishing_lava"; } break; + case "trophy": + if (showSession) { + LootDisplay.display = "fishing_trophy_session"; + } else { + LootDisplay.display = "fishing_trophy"; + } + break; default: if (showSession) { LootDisplay.display = "fishing_session"; diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 46d9906..6658bcd 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -3,6 +3,7 @@ package me.Danker.commands; import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.FishingTracker; +import me.Danker.features.loot.TrophyFishTracker; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; @@ -63,7 +64,9 @@ public class ImportFishingCommand extends CommandBase { } System.out.println("Fetching fishing stats..."); - JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject(); + JsonObject memberObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); + JsonObject statsObject = memberObject.get("stats").getAsJsonObject(); + JsonObject trophyObject = memberObject.get("trophy_fish").getAsJsonObject(); FishingTracker.greatCatches = 0; FishingTracker.goodCatches = 0; @@ -123,7 +126,7 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.thunders = getSCFromApi(statsObject, "kills_thunder"); FishingTracker.lordJawbuses = getSCFromApi(statsObject, "kills_lord_jawbus"); - System.out.println("Writing to config..."); + System.out.println("Writing SC to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); ConfigHandler.writeIntConfig("fishing", "greatCatch", FishingTracker.greatCatches); ConfigHandler.writeIntConfig("fishing", "seaCreature", FishingTracker.seaCreatures); @@ -172,6 +175,27 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "thunder", FishingTracker.thunders); ConfigHandler.writeIntConfig("fishing", "lordJawbus", FishingTracker.lordJawbuses); + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fish.add("Sulpher Skitter", getTrophyFromAPI(trophyObject, "sulphur_skitter")); + TrophyFishTracker.fish.add("Obfuscated 1", getTrophyFromAPI(trophyObject, "obfuscated_fish_1")); + TrophyFishTracker.fish.add("Steaming-Hot Flounder", getTrophyFromAPI(trophyObject, "steaming_hot_flounder")); + TrophyFishTracker.fish.add("Obfuscated 2", getTrophyFromAPI(trophyObject, "obfuscated_fish_2")); + TrophyFishTracker.fish.add("Gusher", getTrophyFromAPI(trophyObject, "gusher")); + TrophyFishTracker.fish.add("Blobfish", getTrophyFromAPI(trophyObject, "blobfish")); + TrophyFishTracker.fish.add("Slugfish", getTrophyFromAPI(trophyObject, "slugfish")); + TrophyFishTracker.fish.add("Obfuscated 3", getTrophyFromAPI(trophyObject, "obfuscated_fish_3")); + TrophyFishTracker.fish.add("Flyfish", getTrophyFromAPI(trophyObject, "flyfish")); + TrophyFishTracker.fish.add("Lavahorse", getTrophyFromAPI(trophyObject, "lava_horse")); + TrophyFishTracker.fish.add("Mana Ray", getTrophyFromAPI(trophyObject, "mana_ray")); + TrophyFishTracker.fish.add("Volcanic Stonefish", getTrophyFromAPI(trophyObject, "volcanic_stonefish")); + TrophyFishTracker.fish.add("Vanille", getTrophyFromAPI(trophyObject, "vanille")); + TrophyFishTracker.fish.add("Skeleton Fish", getTrophyFromAPI(trophyObject, "skeleton_fish")); + TrophyFishTracker.fish.add("Moldfin", getTrophyFromAPI(trophyObject, "moldfin")); + TrophyFishTracker.fish.add("Soul Fish", getTrophyFromAPI(trophyObject, "soul_fish")); + TrophyFishTracker.fish.add("Karate Fish", getTrophyFromAPI(trophyObject, "karate_fish")); + TrophyFishTracker.fish.add("Golden Fish", getTrophyFromAPI(trophyObject, "golden_fish")); + TrophyFishTracker.save(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } @@ -183,4 +207,15 @@ public class ImportFishingCommand extends CommandBase { return sc; } + static JsonObject getTrophyFromAPI(JsonObject obj, String name) { + JsonObject tiers = new JsonObject(); + + tiers.addProperty("BRONZE", obj.has(name + "_bronze") ? obj.get(name + "_bronze").getAsInt() : 0); + tiers.addProperty("SILVER", obj.has(name + "_silver") ? obj.get(name + "_silver").getAsInt() : 0); + tiers.addProperty("GOLD", obj.has(name + "_gold") ? obj.get(name + "_gold").getAsInt() : 0); + tiers.addProperty("DIAMOND", obj.has(name + "_diamond") ? obj.get(name + "_diamond").getAsInt() : 0); + + return tiers; + } + } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index af5479e..3c224bb 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/f(1-7)/mm/session]"; + return "/" + getCommandName() + " [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +41,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -621,6 +621,54 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Creatures Since Lord Jawbus: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; + } else if (arg1[1].equalsIgnoreCase("trophy")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary (Current Session):\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary:\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 9ccef33..00cf8f6 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -293,6 +293,10 @@ public class ResetLootCommand extends CommandBase { FishingTracker.jawbusSCsSession = -1; ConfigHandler.deleteCategory("fishing"); ConfigHandler.reloadConfig(); + + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fishSession = TrophyFishTracker.createEmpty(); + TrophyFishTracker.save(); } static void resetMythological() { diff --git a/src/main/java/me/Danker/events/ModInitEvent.java b/src/main/java/me/Danker/events/ModInitEvent.java new file mode 100644 index 0000000..e1cc644 --- /dev/null +++ b/src/main/java/me/Danker/events/ModInitEvent.java @@ -0,0 +1,13 @@ +package me.Danker.events; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class ModInitEvent extends Event { + + public final String configDirectory; + + public ModInitEvent(String configDirectory) { + this.configDirectory = configDirectory; + } + +} diff --git a/src/main/java/me/Danker/features/Alerts.java b/src/main/java/me/Danker/features/Alerts.java index 8f45423..e54a212 100644 --- a/src/main/java/me/Danker/features/Alerts.java +++ b/src/main/java/me/Danker/features/Alerts.java @@ -3,6 +3,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; import javafx.scene.control.Alert; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; @@ -24,6 +25,11 @@ public class Alerts { public static HashMap patterns = new HashMap<>(); public static String configFile; + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmalerts.json"; + } + @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { if (!ToggleCommand.alerts || event.type == 2) return; diff --git a/src/main/java/me/Danker/features/ChatAliases.java b/src/main/java/me/Danker/features/ChatAliases.java index ae9e0f7..76ab5f6 100644 --- a/src/main/java/me/Danker/features/ChatAliases.java +++ b/src/main/java/me/Danker/features/ChatAliases.java @@ -1,6 +1,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; +import me.Danker.events.ModInitEvent; import me.Danker.events.PacketWriteEvent; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C01PacketChatMessage; @@ -16,6 +17,11 @@ public class ChatAliases { public static List aliases = new ArrayList<>(); public static String configFile; + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmaliases.json"; + } + @SubscribeEvent public void onPacketWrite(PacketWriteEvent event) { if (event.packet instanceof C01PacketChatMessage) { diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 8ce8c05..e6f8131 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -2,6 +2,7 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; @@ -13,6 +14,7 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -196,6 +198,11 @@ public class CustomMusic { } } + @SubscribeEvent + public void init(ModInitEvent event) { + init(event.configDirectory); + } + public static void init(String configDirectory) { if (configDirectory == null) return; File directory = new File(configDirectory + "/dsmmusic"); diff --git a/src/main/java/me/Danker/features/GemstonesLore.java b/src/main/java/me/Danker/features/GemstonesLore.java index 7db2d33..b16edaf 100644 --- a/src/main/java/me/Danker/features/GemstonesLore.java +++ b/src/main/java/me/Danker/features/GemstonesLore.java @@ -1,6 +1,7 @@ package me.Danker.features; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; @@ -18,7 +19,8 @@ public class GemstonesLore { static Map gemstoneColours = new HashMap<>(); - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { gemstoneColours.put("Amber", EnumChatFormatting.GOLD); gemstoneColours.put("Sapphire", EnumChatFormatting.AQUA); gemstoneColours.put("Jasper", EnumChatFormatting.LIGHT_PURPLE); diff --git a/src/main/java/me/Danker/features/GoldenEnchants.java b/src/main/java/me/Danker/features/GoldenEnchants.java index d633ec5..228d43e 100644 --- a/src/main/java/me/Danker/features/GoldenEnchants.java +++ b/src/main/java/me/Danker/features/GoldenEnchants.java @@ -1,6 +1,7 @@ package me.Danker.features; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -15,7 +16,8 @@ public class GoldenEnchants { public static Map t6Enchants = new HashMap<>(); public static Pattern t6EnchantPattern = Pattern.compile(""); - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { t6Enchants.put("9Angler VI", "6Angler VI"); t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); t6Enchants.put("9Caster VI", "6Caster VI"); diff --git a/src/main/java/me/Danker/features/MinionLastCollected.java b/src/main/java/me/Danker/features/MinionLastCollected.java index 884dccf..7079f40 100644 --- a/src/main/java/me/Danker/features/MinionLastCollected.java +++ b/src/main/java/me/Danker/features/MinionLastCollected.java @@ -3,6 +3,7 @@ package me.Danker.features; import com.google.gson.GsonBuilder; import me.Danker.commands.ToggleCommand; import me.Danker.events.ChestSlotClickedEvent; +import me.Danker.events.ModInitEvent; import me.Danker.events.PacketWriteEvent; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; @@ -28,6 +29,11 @@ public class MinionLastCollected { static BlockPos lastMinion = null; public static int LAST_COLLECTED_COLOUR; + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmminions.json"; + } + @SubscribeEvent public void onPacketWrite(PacketWriteEvent event) { if (ToggleCommand.minionLastCollected && Utils.inSkyblock && Utils.isInScoreboard("Your Island")) { diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 7832362..556108c 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -946,6 +946,82 @@ public class LootDisplay { EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; + case "fishing_trophy": + dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + + EnumChatFormatting.WHITE + "Obfuscated 1:\n" + + EnumChatFormatting.WHITE + "Steaminghot Flounder:\n" + + EnumChatFormatting.WHITE + "Gusher:\n" + + EnumChatFormatting.WHITE + "Blobfish:\n" + + EnumChatFormatting.GREEN + "Obfuscated 2:\n" + + EnumChatFormatting.GREEN + "Slugfish:\n" + + EnumChatFormatting.GREEN + "Flyfish:\n" + + EnumChatFormatting.BLUE + "Obfuscated 3:\n" + + EnumChatFormatting.BLUE + "Lavahorse:\n" + + EnumChatFormatting.BLUE + "Mana Ray:\n" + + EnumChatFormatting.BLUE + "Volcanic Stonefish:\n" + + EnumChatFormatting.BLUE + "Vanille:\n" + + EnumChatFormatting.DARK_PURPLE + "Skeleton Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Moldfin:\n" + + EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + + EnumChatFormatting.GOLD + "Golden Fish:"; + countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish"); + break; + case "fishing_trophy_session": + dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + + EnumChatFormatting.WHITE + "Obfuscated 1:\n" + + EnumChatFormatting.WHITE + "Steaminghot Flounder:\n" + + EnumChatFormatting.WHITE + "Gusher:\n" + + EnumChatFormatting.WHITE + "Blobfish:\n" + + EnumChatFormatting.GREEN + "Obfuscated 2:\n" + + EnumChatFormatting.GREEN + "Slugfish:\n" + + EnumChatFormatting.GREEN + "Flyfish:\n" + + EnumChatFormatting.BLUE + "Obfuscated 3:\n" + + EnumChatFormatting.BLUE + "Lavahorse:\n" + + EnumChatFormatting.BLUE + "Mana Ray:\n" + + EnumChatFormatting.BLUE + "Volcanic Stonefish:\n" + + EnumChatFormatting.BLUE + "Vanille:\n" + + EnumChatFormatting.DARK_PURPLE + "Skeleton Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Moldfin:\n" + + EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + + EnumChatFormatting.GOLD + "Golden Fish:"; + countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish"); + break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + diff --git a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java new file mode 100644 index 0000000..d11fcfe --- /dev/null +++ b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java @@ -0,0 +1,120 @@ +package me.Danker.features.loot; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import me.Danker.events.ModInitEvent; +import me.Danker.utils.Utils; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TrophyFishTracker { + + public static JsonObject fish = new JsonObject(); + public static JsonObject fishSession = new JsonObject(); + public static Pattern fishPattern = Pattern.compile("TROPHY FISH! You caught a (?.*) (?.*)."); + public static String configFile; + + public static JsonObject createEmpty() { + JsonObject fish = new JsonObject(); + + JsonObject tiers = new JsonObject(); + tiers.addProperty("BRONZE", 0); + tiers.addProperty("SILVER", 0); + tiers.addProperty("GOLD", 0); + tiers.addProperty("DIAMOND", 0); + + fish.add("Sulpher Skitter", Utils.deepCopy(tiers)); + fish.add("Obfuscated 1", Utils.deepCopy(tiers)); + fish.add("Steaming-Hot Flounder", Utils.deepCopy(tiers)); + fish.add("Obfuscated 2", Utils.deepCopy(tiers)); + fish.add("Gusher", Utils.deepCopy(tiers)); + fish.add("Blobfish", Utils.deepCopy(tiers)); + fish.add("Slugfish", Utils.deepCopy(tiers)); + fish.add("Obfuscated 3", Utils.deepCopy(tiers)); + fish.add("Flyfish", Utils.deepCopy(tiers)); + fish.add("Lavahorse", Utils.deepCopy(tiers)); + fish.add("Mana Ray", Utils.deepCopy(tiers)); + fish.add("Volcanic Stonefish", Utils.deepCopy(tiers)); + fish.add("Vanille", Utils.deepCopy(tiers)); + fish.add("Skeleton Fish", Utils.deepCopy(tiers)); + fish.add("Moldfin", Utils.deepCopy(tiers)); + fish.add("Soul Fish", Utils.deepCopy(tiers)); + fish.add("Karate Fish", Utils.deepCopy(tiers)); + fish.add("Golden Fish", Utils.deepCopy(tiers)); + + return fish; + } + + @SubscribeEvent + public void init(ModInitEvent event) { + configFile = event.configDirectory + "/dsmtrophyfish.json"; + if (fish.entrySet().isEmpty()) fish = createEmpty(); + fishSession = createEmpty(); + } + + @SubscribeEvent(receiveCanceled = true) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!Utils.inSkyblock) return; + if (!Utils.tabLocation.equals("Crimson Isle")) return; + if (event.type == 2) return; + if (message.contains(":")) return; + + Matcher matcher = fishPattern.matcher(message); + + if (matcher.matches()) { + String fishName = matcher.group("fish"); + String tier = matcher.group("tier"); + + JsonObject fishObj = fish.get(fishName).getAsJsonObject(); + int amount = fishObj.get(tier).getAsInt(); + fishObj.addProperty(tier, amount + 1); + + JsonObject fishSessionObj = fishSession.get(fishName).getAsJsonObject(); + int amountSession = fishSessionObj.get(tier).getAsInt(); + fishSessionObj.addProperty(tier, amountSession + 1); + + save(); + } + } + + public static void save() { + try (FileWriter writer = new FileWriter(configFile)) { + new GsonBuilder().create().toJson(fish, writer); + writer.flush(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + public static String getTierCount(JsonObject obj, String name) { + JsonObject type = obj.get(name).getAsJsonObject(); + + int bronze = type.get("BRONZE").getAsInt(); + int silver = type.get("SILVER").getAsInt(); + int gold = type.get("GOLD").getAsInt(); + int diamond = type.get("DIAMOND").getAsInt(); + + return EnumChatFormatting.DARK_GRAY + "" + bronze + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.GRAY + silver + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.GOLD + gold + EnumChatFormatting.WHITE + "-" + + EnumChatFormatting.AQUA + diamond; + } + + public static int getSum(JsonObject obj, String name) { + JsonObject type = obj.get(name).getAsJsonObject(); + return type.get("BRONZE").getAsInt() + + type.get("SILVER").getAsInt() + + type.get("GOLD").getAsInt() + + type.get("DIAMOND").getAsInt(); + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index dd2c23e..23d0228 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -5,6 +5,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; @@ -26,7 +27,8 @@ public class TriviaSolver { static JsonArray triviaAnswersJson = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; - public static void init() { + @SubscribeEvent + public void init(ModInitEvent event) { // Hard coded solutions if api call fails triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); @@ -39,11 +41,12 @@ public class TriviaSolver { triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"227 Fairy Souls"}); + triviaSolutions.put("What is the status of Maxor, Storm, Goldor and Necron?", new String[]{"Wither Lord"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"238 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Crimson Isle?", new String[]{"29 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); @@ -57,7 +60,7 @@ public class TriviaSolver { triviaSolutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); triviaSolutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); - triviaSolutions.put("How many unique minions are there?", new String[]{"53 Minions"}); + triviaSolutions.put("How many unique minions are there?", new String[]{"55 Minions"}); triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", "Dashing Spooder", "Broodfather", "Night Spider"}); triviaSolutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index b8be3d6..2afa187 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -5,6 +5,7 @@ import me.Danker.handlers.ConfigHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -28,6 +29,7 @@ public class DisplayGui extends GuiScreen { private GuiButton fishingSpooky; private GuiButton fishingCH; private GuiButton fishingLava; + private GuiButton fishingTrophy; private GuiButton catacombsF1; private GuiButton catacombsF2; private GuiButton catacombsF3; @@ -61,12 +63,13 @@ public class DisplayGui extends GuiScreen { wolf = new GuiButton(0, width / 2 - 50, (int) (height * 0.35), 100, 20, "Wolf"); enderman = new GuiButton(0, width / 2 + 60, (int) (height * 0.35), 100, 20, "Enderman"); blaze = new GuiButton(0, width / 2 + 170, (int) (height * 0.35), 100, 20, "Blaze"); - fishing = new GuiButton(0, width / 2 - 295, (int) (height * 0.5), 90, 20, "Fishing"); - fishingWinter = new GuiButton(0, width / 2 - 195, (int) (height * 0.5), 90, 20, "Fishing Winter"); - fishingFestival = new GuiButton(0, width / 2 - 95, (int) (height * 0.5), 90, 20, "Fishing Festival"); - fishingSpooky = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 90, 20, "Fishing Spooky"); - fishingCH = new GuiButton(0, width / 2 + 105, (int) (height * 0.5), 90, 20, "CH Fishing"); - fishingLava = new GuiButton(0, width / 2 + 205, (int) (height * 0.5), 90, 20, "Lava Fishing"); + fishing = new GuiButton(0, width / 2 - 310, (int) (height * 0.5), 80, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 220, (int) (height * 0.5), 80, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 - 130, (int) (height * 0.5), 80, 20, "Fishing Festival"); + fishingSpooky = new GuiButton(0, width / 2 - 40, (int) (height * 0.5), 80, 20, "Fishing Spooky"); + fishingCH = new GuiButton(0, width / 2 + 50, (int) (height * 0.5), 80, 20, "CH Fishing"); + fishingLava = new GuiButton(0, width / 2 + 140, (int) (height * 0.5), 80, 20, "Lava Fishing"); + fishingTrophy = new GuiButton(0, width / 2 + 230, (int) (height * 0.5), 80, 20, "Fishing Trophy"); catacombsF1 = new GuiButton(0, width / 2 - 235, (int) (height * 0.65), 50, 20, "F1"); catacombsF2 = new GuiButton(0, width / 2 - 175, (int) (height * 0.65), 50, 20, "F2"); catacombsF3 = new GuiButton(0, width / 2 - 115, (int) (height * 0.65), 50, 20, "F3"); @@ -92,6 +95,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(fishingSpooky); this.buttonList.add(fishingCH); this.buttonList.add(fishingLava); + this.buttonList.add(fishingTrophy); this.buttonList.add(catacombsF1); this.buttonList.add(catacombsF2); this.buttonList.add(catacombsF3); @@ -153,6 +157,8 @@ public class DisplayGui extends GuiScreen { setDisplay("fishing_ch"); } else if (button == fishingLava) { setDisplay("fishing_lava"); + } else if (button == fishingTrophy) { + setDisplay("fishing_trophy"); } else if (button == mythological) { setDisplay("mythological"); } else if (button == catacombsF1) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index bd60639..b2c51a4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,7 +1,6 @@ package me.Danker.handlers; -import com.google.gson.Gson; -import com.google.gson.JsonArray; +import com.google.gson.*; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -750,6 +749,14 @@ public class ConfigHandler { } MinionLastCollected.Minion[] minions = gson.fromJson(new FileReader(MinionLastCollected.configFile), MinionLastCollected.Minion[].class); if (minions != null) MinionLastCollected.minions = new ArrayList<>(Arrays.asList(minions)); + + // Trophy Fish + if (!(new File(TrophyFishTracker.configFile).exists())) { + FileWriter file = new FileWriter(TrophyFishTracker.configFile); + file.write(new JsonObject().toString()); + file.close(); + } + TrophyFishTracker.fish = new JsonParser().parse(new FileReader(TrophyFishTracker.configFile)).getAsJsonObject(); } catch (IOException ex) { ex.printStackTrace(); } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 3cef436..094690e 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,5 +1,7 @@ package me.Danker.utils; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.ColouredNames; import me.Danker.features.GoldenEnchants; @@ -509,6 +511,16 @@ public class Utils { } } + public static JsonObject deepCopy(JsonObject obj) { + JsonObject newObj = new JsonObject(); + + for (Map.Entry entry : obj.entrySet()) { + newObj.add(entry.getKey(), entry.getValue()); + } + + return newObj; + } + public enum DungeonFloor { NONE, E0, -- cgit From 66fa83a1942b4ec79c5fa94168c04b84c60c628a Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 6 Aug 2022 22:08:32 -0400 Subject: Add trophy fish completion to display --- .../java/me/Danker/commands/ToggleCommand.java | 1 + src/main/java/me/Danker/features/Alerts.java | 1 - .../me/Danker/features/CrystalHollowWaypoints.java | 1 - src/main/java/me/Danker/features/CustomMusic.java | 1 - .../java/me/Danker/features/loot/LootDisplay.java | 46 +++++++++++++++++++++- .../me/Danker/features/loot/TrophyFishTracker.java | 23 +++++++++++ src/main/java/me/Danker/gui/DankerGui.java | 7 ++++ src/main/java/me/Danker/gui/DisplayGui.java | 1 - .../java/me/Danker/gui/alerts/AlertActionGui.java | 1 - .../java/me/Danker/handlers/ConfigHandler.java | 6 ++- src/main/java/me/Danker/utils/RenderUtils.java | 9 +++-- src/main/java/me/Danker/utils/Utils.java | 2 +- 12 files changed, 86 insertions(+), 13 deletions(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index c08d50a..3c353c8 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -65,6 +65,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean aliases; public static boolean fishingAlert; public static boolean minionLastCollected; + public static boolean showTrophyCompletion; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; diff --git a/src/main/java/me/Danker/features/Alerts.java b/src/main/java/me/Danker/features/Alerts.java index e54a212..aa6197f 100644 --- a/src/main/java/me/Danker/features/Alerts.java +++ b/src/main/java/me/Danker/features/Alerts.java @@ -1,7 +1,6 @@ package me.Danker.features; import com.google.gson.GsonBuilder; -import javafx.scene.control.Alert; import me.Danker.commands.ToggleCommand; import me.Danker.events.ModInitEvent; import me.Danker.utils.Utils; diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java index 39a71b4..12aa94e 100644 --- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -7,7 +7,6 @@ import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index e6f8131..32af6c9 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -14,7 +14,6 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 556108c..fe68c3e 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -965,7 +965,7 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + EnumChatFormatting.GOLD + "Golden Fish:"; - countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + if (!ToggleCommand.showTrophyCompletion) countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + @@ -983,6 +983,27 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish"); + + if (ToggleCommand.showTrophyCompletion) { + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Sulpher Skitter", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 1", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Steaming-Hot Flounder", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (2 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Gusher", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (3 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Blobfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (4 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 2", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (5 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Slugfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (6 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Flyfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (7 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Obfuscated 3", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (8 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Lavahorse", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (9 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Mana Ray", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (10 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Volcanic Stonefish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (11 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Vanille", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (12 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Skeleton Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (13 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Moldfin", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (14 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Soul Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (15 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Karate Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (16 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fish, "Golden Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (17 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + } break; case "fishing_trophy_session": dropsText = EnumChatFormatting.WHITE + "Sulpher Skitter:\n" + @@ -1003,7 +1024,7 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + "Soul Fish:\n" + EnumChatFormatting.DARK_PURPLE + "Karate Fish:\n" + EnumChatFormatting.GOLD + "Golden Fish:"; - countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + if (!ToggleCommand.showTrophyCompletion) countText = EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + EnumChatFormatting.WHITE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + @@ -1021,6 +1042,27 @@ public class LootDisplay { EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + EnumChatFormatting.DARK_PURPLE + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + EnumChatFormatting.GOLD + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish"); + + if (ToggleCommand.showTrophyCompletion) { + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Sulpher Skitter", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 1", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Steaming-Hot Flounder", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (2 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Gusher", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (3 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Blobfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (4 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 2", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (5 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Slugfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (6 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Flyfish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (7 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Obfuscated 3", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (8 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Lavahorse", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (9 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Mana Ray", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (10 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Volcanic Stonefish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (11 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Vanille", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (12 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Skeleton Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (13 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Moldfin", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (14 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Soul Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (15 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Karate Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (16 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + TrophyFishTracker.drawCompletion(TrophyFishTracker.fishSession, "Golden Fish", (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (17 * mc.fontRendererObj.FONT_HEIGHT * ScaleCommand.displayScale)), ScaleCommand.displayScale); + } break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + diff --git a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java index d11fcfe..6202871 100644 --- a/src/main/java/me/Danker/features/loot/TrophyFishTracker.java +++ b/src/main/java/me/Danker/features/loot/TrophyFishTracker.java @@ -3,7 +3,10 @@ package me.Danker.features.loot; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import me.Danker.events.ModInitEvent; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -117,4 +120,24 @@ public class TrophyFishTracker { type.get("DIAMOND").getAsInt(); } + public static void drawCompletion(JsonObject obj, String name, int x, int y, double scale) { + JsonObject type = obj.get(name).getAsJsonObject(); + + boolean bronze = type.get("BRONZE").getAsInt() > 0; + boolean silver = type.get("SILVER").getAsInt() > 0; + boolean gold = type.get("GOLD").getAsInt() > 0; + boolean diamond = type.get("DIAMOND").getAsInt() > 0; + + ItemStack incomplete = new ItemStack(Items.dye, 1, 8); + ItemStack bronzeComplete = new ItemStack(Items.brick); + ItemStack silverComplete = new ItemStack(Items.iron_ingot); + ItemStack goldComplete = new ItemStack(Items.gold_ingot); + ItemStack diamondComplete = new ItemStack(Items.diamond); + + RenderUtils.renderItem(bronze ? bronzeComplete : incomplete, x, y - 2, scale / 1.3D); + RenderUtils.renderItem(silver ? silverComplete : incomplete, x + 15, y - 2, scale / 1.3D); + RenderUtils.renderItem(gold ? goldComplete : incomplete, x + 30, y - 2, scale / 1.3D); + RenderUtils.renderItem(diamond ? diamondComplete : incomplete, x + 45, y - 2, scale / 1.3D); + } + } diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index c247eab..cab2b5c 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -93,6 +93,7 @@ public class DankerGui extends GuiScreen { private GuiButton firePillar; private GuiButton fishingAlert; private GuiButton minionLastCollected; + private GuiButton showTrophyCompletion; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -190,6 +191,7 @@ public class DankerGui extends GuiScreen { firePillar = new FeatureButton("Fire Pillar Display: " + Utils.getColouredBoolean(ToggleCommand.firePillar), "Displays blaze fire pillar text on screen"); fishingAlert = new FeatureButton("Fishing Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.fishingAlert), "Alerts when a Thunder or Lord Jawbus spawns nearby"); minionLastCollected = new FeatureButton("Show When Minion Last Collected: " + Utils.getColouredBoolean(ToggleCommand.minionLastCollected), "Displays when a minion was last collected over the minion."); + showTrophyCompletion = new FeatureButton("Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion), "Show completion instead of count in trophy fish tracker display."); allButtons.clear(); allButtons.add(changeDisplay); @@ -253,6 +255,7 @@ public class DankerGui extends GuiScreen { allButtons.add(firePillar); allButtons.add(fishingAlert); allButtons.add(minionLastCollected); + allButtons.add(showTrophyCompletion); search.setText(initSearchText); search.setVisible(true); @@ -558,6 +561,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.minionLastCollected = !ToggleCommand.minionLastCollected; ConfigHandler.writeBooleanConfig("toggles", "MinionLastCollected", ToggleCommand.minionLastCollected); minionLastCollected.displayString = "Show When Minion Last Collected: " + Utils.getColouredBoolean(ToggleCommand.minionLastCollected); + } else if (button == showTrophyCompletion) { + ToggleCommand.showTrophyCompletion = !ToggleCommand.showTrophyCompletion; + ConfigHandler.writeBooleanConfig("toggles", "ShowTrophyCompletion", ToggleCommand.showTrophyCompletion); + showTrophyCompletion.displayString = "Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion); } } diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 2afa187..f7fd2f3 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -5,7 +5,6 @@ import me.Danker.handlers.ConfigHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; diff --git a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java index 4853ac1..02c3d3b 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java @@ -1,7 +1,6 @@ package me.Danker.gui.alerts; import me.Danker.features.Alerts; -import me.Danker.handlers.TextRenderer; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index b2c51a4..484a7d5 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,6 +1,9 @@ package me.Danker.handlers; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -249,6 +252,7 @@ public class ConfigHandler { ToggleCommand.aliases = initBoolean("toggles", "Aliases", false); ToggleCommand.fishingAlert = initBoolean("toggles", "FishingAlert", false); ToggleCommand.minionLastCollected = initBoolean("toggles", "MinionLastCollected", false); + ToggleCommand.showTrophyCompletion = initBoolean("toggles", "ShowTrophyCompletion", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index c3efc90..f334b7a 100644 --- a/src/main/java/me/Danker/utils/RenderUtils.java +++ b/src/main/java/me/Danker/utils/RenderUtils.java @@ -387,15 +387,16 @@ public class RenderUtils { GlStateManager.popMatrix(); } - public static void renderItem(ItemStack item, float x, float y, float z) { - + public static void renderItem(ItemStack stack, int x, int y, double scale) { GlStateManager.enableRescaleNormal(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableDepth(); GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, z); - Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(item, 0, 0); + GlStateManager.translate(x, y, 0); + GlStateManager.scale(scale, scale, scale); + //Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(stack, 0, 0); + Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); GlStateManager.popMatrix(); GlStateManager.disableDepth(); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 094690e..4aa094d 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -22,8 +22,8 @@ import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.*; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -- cgit From 4431e9eddd09e4d43c42f6e541810c47c83efdcb Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 6 Aug 2022 22:58:03 -0400 Subject: Use sound packet for slayer token drop tracking Fixes token drops not being tracked when volume is off. --- .../java/me/Danker/features/loot/LootTracker.java | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/main/java/me/Danker/features') 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(".*? \\((?\\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 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"); -- cgit From 1a0a3ca6e58adf11729fa9078150e3b140b6bfed Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 7 Aug 2022 16:37:55 -0400 Subject: Fix minions showing across profiles --- src/main/java/me/Danker/features/MinionLastCollected.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/MinionLastCollected.java b/src/main/java/me/Danker/features/MinionLastCollected.java index 7079f40..d793970 100644 --- a/src/main/java/me/Danker/features/MinionLastCollected.java +++ b/src/main/java/me/Danker/features/MinionLastCollected.java @@ -13,6 +13,7 @@ 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; @@ -72,6 +73,7 @@ public class MinionLastCollected { 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); } } @@ -98,6 +100,12 @@ public class MinionLastCollected { return null; } + public boolean minionExistsAtPos(BlockPos pos) { + AxisAlignedBB aabb = new AxisAlignedBB(pos, pos.add(1, 1, 1)); + List 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); -- cgit From 60d3517fc1f70aeeb83dd6627ade3093f7760b04 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 9 Aug 2022 19:31:36 -0400 Subject: Fix F7 custom music for real this time Also fix /dsmmusic volume not working --- src/main/java/me/Danker/features/CustomMusic.java | 58 ++++++++++++++++------- 1 file changed, 42 insertions(+), 16 deletions(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 32af6c9..6c5dd08 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -68,8 +68,7 @@ public class CustomMusic { public static Song park; public static int parkVolume; - static int curPhase = -1; - + static int curPhase = 0; @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -97,9 +96,29 @@ public class CustomMusic { firstLine.contains("30,344") || // F4 firstLine.contains("livid") || // F5 firstLine.contains("sadan") || // F6 - firstLine.contains("maxor")) { // F7 - - if (ToggleCommand.dungeonBossMusic && curPhase == -1) 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 { @@ -156,26 +175,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(); curPhase = 2; - } else if (message.startsWith("[BOSS] Goldor: Who dares trespass into my domain?")) { + } else if (phase3.hasSongs() && message.startsWith("[BOSS] Goldor: Who dares trespass into my domain?")) { phase3.start(); curPhase = 3; - } else if (message.startsWith("[BOSS] Necron: You went further than any human before")) { + } else if (phase4.hasSongs() && message.startsWith("[BOSS] Necron: You went further than any human before")) { phase4.start(); curPhase = 4; - } else if (message.startsWith("[BOSS] ") && message.endsWith("You.. again?")) { + } 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(); @@ -250,7 +270,7 @@ public class CustomMusic { if (crimsonIsle != null) crimsonIsle.stop(); if (end != null) end.stop(); if (park != null) park.stop(); - curPhase = -1; + curPhase = 0; } public static class Song { @@ -321,14 +341,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; + } + } } -- cgit From f56302bee3939677fc3fd015a97b12b5100c45b1 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 9 Aug 2022 20:24:18 -0400 Subject: Fix issues with custom music volume Fix custom music set to 50% volume on first load (ignoring config) Fix island music using hub volume --- src/main/java/me/Danker/DankersSkyblockMod.java | 8 +++----- src/main/java/me/Danker/events/PostConfigInitEvent.java | 13 +++++++++++++ src/main/java/me/Danker/features/CustomMusic.java | 5 +++-- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 src/main/java/me/Danker/events/PostConfigInitEvent.java (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 6322c33..280fc96 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -2,10 +2,7 @@ package me.Danker; import com.google.gson.JsonObject; import me.Danker.commands.*; -import me.Danker.events.ChestSlotClickedEvent; -import me.Danker.events.GuiChestBackgroundDrawnEvent; -import me.Danker.events.ModInitEvent; -import me.Danker.events.RenderOverlayEvent; +import me.Danker.events.*; import me.Danker.features.*; import me.Danker.features.loot.*; import me.Danker.features.puzzlesolvers.*; @@ -181,9 +178,10 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new TrophyFishTracker()); MinecraftForge.EVENT_BUS.register(new WolfTracker()); MinecraftForge.EVENT_BUS.register(new ZombieTracker()); - + MinecraftForge.EVENT_BUS.post(new ModInitEvent(configDirectory)); ConfigHandler.reloadConfig(); + 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/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/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 6c5dd08..38e4ba0 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -3,6 +3,7 @@ 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; @@ -218,7 +219,7 @@ public class CustomMusic { } @SubscribeEvent - public void init(ModInitEvent event) { + public void postConfigInit(PostConfigInitEvent event) { init(event.configDirectory); } @@ -237,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); -- cgit