diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-03-04 13:20:20 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-03-04 13:20:20 -0500 |
commit | 2b57ccad6d21b325c3164117fe14e00e13399a7c (patch) | |
tree | ba0d560ed179fa3eb412996ac55ea3c920c2d88d /src/main/java/me/Danker | |
parent | 42b556c49db4d848cddca76b383135dcdaad99fa (diff) | |
download | SkyblockMod-2b57ccad6d21b325c3164117fe14e00e13399a7c.tar.gz SkyblockMod-2b57ccad6d21b325c3164117fe14e00e13399a7c.tar.bz2 SkyblockMod-2b57ccad6d21b325c3164117fe14e00e13399a7c.zip |
Add CH fishing tracker
Organized change display GUI
Add method to make centered text rendering easier
Diffstat (limited to 'src/main/java/me/Danker')
17 files changed, 269 insertions, 89 deletions
diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index d335a8a..3db6853 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <zombie/spider/wolf/enderman/fishing/catacombs/mythological/ghost/auto/off> [winter/festival/spooky/session/f(1-7)/mm]"; + return "/" + getCommandName() + " <zombie/spider/wolf/enderman/fishing/catacombs/mythological/ghost/auto/off> [winter/festival/spooky/ch/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", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "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) { @@ -113,6 +113,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "fishing_spooky"; } break; + case "ch": + if (showSession) { + LootDisplay.display = "fishing_ch"; + } else { + LootDisplay.display = "fishing_ch_session"; + } + 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 3ee5ebd..bdd3281 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -37,22 +37,22 @@ public class ImportFishingCommand extends CommandBase { // MULTI THREAD DRIFTING new Thread(() -> { EntityPlayer player = (EntityPlayer) arg0; - + // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); return; } - + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Importing your fishing stats...")); - + // Get UUID for Hypixel API requests String uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - + String latestProfile = APIHandler.getLatestProfileID(uuid, key); if (latestProfile == null) return; - + String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key; System.out.println("Fetching profile..."); JsonObject profileResponse = APIHandler.getResponse(profileURL, true); @@ -61,10 +61,10 @@ public class ImportFishingCommand extends CommandBase { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } - + System.out.println("Fetching fishing stats..."); JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject(); - + FishingTracker.greatCatches = 0; FishingTracker.goodCatches = 0; if (statsObject.has("items_fished_treasure")) { @@ -75,44 +75,44 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.goodCatches = statsObject.get("items_fished_treasure").getAsInt(); } } - + FishingTracker.seaCreatures = 0; FishingTracker.squids = 0; if (statsObject.has("kills_pond_squid")) { FishingTracker.squids = statsObject.get("kills_pond_squid").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.squids; - + FishingTracker.seaWalkers = 0; if (statsObject.has("kills_sea_walker")) { FishingTracker.seaWalkers = statsObject.get("kills_sea_walker").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaWalkers; - + FishingTracker.nightSquids = 0; if (statsObject.has("kills_night_squid")) { FishingTracker.nightSquids = statsObject.get("kills_night_squid").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.nightSquids; - + FishingTracker.seaGuardians = 0; if (statsObject.has("kills_sea_guardian")) { FishingTracker.seaGuardians = statsObject.get("kills_sea_guardian").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaGuardians; - + FishingTracker.seaWitches = 0; if (statsObject.has("kills_sea_witch")) { FishingTracker.seaWitches = statsObject.get("kills_sea_witch").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaWitches; - + FishingTracker.seaArchers = 0; if (statsObject.has("kills_sea_archer")) { FishingTracker.seaArchers = statsObject.get("kills_sea_archer").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaArchers; - + FishingTracker.monsterOfTheDeeps = 0; if (statsObject.has("kills_zombie_deep")) { if (statsObject.has("kills_chicken_deep")) { @@ -124,44 +124,44 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.monsterOfTheDeeps = statsObject.get("kills_chicken_deep").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.monsterOfTheDeeps; - + FishingTracker.catfishes = 0; if (statsObject.has("kills_catfish")) { FishingTracker.catfishes = statsObject.get("kills_catfish").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.catfishes; - + FishingTracker.carrotKings = 0; if (statsObject.has("kills_carrot_king")) { FishingTracker.carrotKings = statsObject.get("kills_carrot_king").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.carrotKings; - + FishingTracker.seaLeeches = 0; if (statsObject.has("kills_sea_leech")) { FishingTracker.seaLeeches = statsObject.get("kills_sea_leech").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaLeeches; - + FishingTracker.guardianDefenders = 0; if (statsObject.has("kills_guardian_defender")) { FishingTracker.guardianDefenders = statsObject.get("kills_guardian_defender").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.guardianDefenders; - + FishingTracker.deepSeaProtectors = 0; if (statsObject.has("kills_deep_sea_protector")) { FishingTracker.deepSeaProtectors = statsObject.get("kills_deep_sea_protector").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.deepSeaProtectors; - + FishingTracker.hydras = 0; if (statsObject.has("kills_water_hydra")) { // Hydra splits FishingTracker.hydras = statsObject.get("kills_water_hydra").getAsInt() / 2; } FishingTracker.seaCreatures += FishingTracker.hydras; - + FishingTracker.seaEmperors = 0; if (statsObject.has("kills_skeleton_emperor")) { if (statsObject.has("kills_guardian_emperor")) { @@ -173,90 +173,126 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.seaEmperors = statsObject.get("kills_guardian_emperor").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.seaEmperors; - + FishingTracker.fishingMilestone = 0; if (statsObject.has("pet_milestone_sea_creatures_killed")) { FishingTracker.fishingMilestone = statsObject.get("pet_milestone_sea_creatures_killed").getAsInt(); } - + FishingTracker.frozenSteves = 0; if (statsObject.has("kills_frozen_steve")) { FishingTracker.frozenSteves = statsObject.get("kills_frozen_steve").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.frozenSteves; - + FishingTracker.frostyTheSnowmans = 0; if (statsObject.has("kills_frosty_the_snowman")) { FishingTracker.frostyTheSnowmans = statsObject.get("kills_frosty_the_snowman").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.frostyTheSnowmans; - + FishingTracker.grinches = 0; if (statsObject.has("kills_grinch")) { FishingTracker.grinches = statsObject.get("kills_grinch").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.grinches; - + FishingTracker.yetis = 0; if (statsObject.has("kills_yeti")) { FishingTracker.yetis = statsObject.get("kills_yeti").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.yetis; - + FishingTracker.nurseSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.nurseSharks = statsObject.get("kills_nurse_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.nurseSharks; - + FishingTracker.blueSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.blueSharks = statsObject.get("kills_blue_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.blueSharks; - + FishingTracker.tigerSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.tigerSharks = statsObject.get("kills_tiger_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.tigerSharks; - + FishingTracker.greatWhiteSharks = 0; if (statsObject.has("kills_nurse_shark")) { FishingTracker.greatWhiteSharks = statsObject.get("kills_great_white_shark").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.greatWhiteSharks; - + FishingTracker.scarecrows = 0; if (statsObject.has("kills_scarecrow")) { FishingTracker.scarecrows = statsObject.get("kills_scarecrow").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.scarecrows; - + FishingTracker.nightmares = 0; if (statsObject.has("kills_nightmare")) { FishingTracker.nightmares = statsObject.get("kills_nightmare").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.nightmares; - + FishingTracker.werewolfs = 0; if (statsObject.has("kills_werewolf")) { FishingTracker.werewolfs = statsObject.get("kills_werewolf").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.werewolfs; - + FishingTracker.phantomFishers = 0; if (statsObject.has("kills_phantom_fisherman")) { FishingTracker.phantomFishers = statsObject.get("kills_phantom_fisherman").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.phantomFishers; - + FishingTracker.grimReapers = 0; if (statsObject.has("kills_grim_reaper")) { FishingTracker.grimReapers = statsObject.get("kills_grim_reaper").getAsInt(); } FishingTracker.seaCreatures += FishingTracker.grimReapers; - + + FishingTracker.waterWorms = 0; + if (statsObject.has("kills_water_worm")) { + FishingTracker.waterWorms = statsObject.get("kills_water_worm").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.waterWorms; + + FishingTracker.poisonedWaterWorms = 0; + if (statsObject.has("kills_poisoned_water_worm")) { + FishingTracker.poisonedWaterWorms = statsObject.get("kills_poisoned_water_worm").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.poisonedWaterWorms; + + FishingTracker.flamingWorms = 0; + if (statsObject.has("kills_flaming_worm")) { + FishingTracker.flamingWorms = statsObject.get("kills_flaming_worm").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.flamingWorms; + + FishingTracker.lavaBlazes = 0; + if (statsObject.has("kills_lava_blaze")) { + FishingTracker.lavaBlazes = statsObject.get("kills_lava_blaze").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.lavaBlazes; + + FishingTracker.lavaPigmen = 0; + if (statsObject.has("kills_lava_pigman")) { + FishingTracker.lavaPigmen = statsObject.get("kills_lava_pigman").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.lavaPigmen; + + FishingTracker.zombieMiners = 0; + if (statsObject.has("kills_zombie_miner")) { + FishingTracker.zombieMiners = statsObject.get("kills_zombie_miner").getAsInt(); + } + FishingTracker.seaCreatures += FishingTracker.zombieMiners; + System.out.println("Writing to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); ConfigHandler.writeIntConfig("fishing", "greatCatch", FishingTracker.greatCatches); @@ -289,7 +325,13 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "werewolf", FishingTracker.werewolfs); ConfigHandler.writeIntConfig("fishing", "phantomFisher", FishingTracker.phantomFishers); ConfigHandler.writeIntConfig("fishing", "grimReaper", FishingTracker.grimReapers); - + ConfigHandler.writeIntConfig("fishing", "waterWorm", FishingTracker.waterWorms); + ConfigHandler.writeIntConfig("fishing", "poisonedWaterWorm", FishingTracker.poisonedWaterWorms); + ConfigHandler.writeIntConfig("fishing", "flamingWorm", FishingTracker.flamingWorms); + ConfigHandler.writeIntConfig("fishing", "lavaBlaze", FishingTracker.lavaBlazes); + ConfigHandler.writeIntConfig("fishing", "lavaPigman", FishingTracker.lavaPigmen); + ConfigHandler.writeIntConfig("fishing", "zombieMiner", FishingTracker.zombieMiners); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 1437b36..2a647c6 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <zombie/spider/wolf/enderman/fishing/catacombs/mythological> [winter/festival/spooky/f(1-7)/mm/session]"; + return "/" + getCommandName() + " <zombie/spider/wolf/enderman/fishing/catacombs/mythological> [winter/festival/spooky/ch/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", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "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) { @@ -451,6 +451,30 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Phantom Fishers: " + nf.format(FishingTracker.phantomFishers) + "\n" + EnumChatFormatting.GOLD + " Grim Reapers: " + nf.format(FishingTracker.grimReapers) + "\n" + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); + } else if (arg1[1].equalsIgnoreCase("ch")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Crystal Hollows Fishing Summary:\n" + + EnumChatFormatting.BLUE + " Water Worms: " + nf.format(FishingTracker.waterWormsSession) + "\n" + + EnumChatFormatting.GREEN + " Poisoned Water Worms: " + nf.format(FishingTracker.poisonedWaterWormsSession) + "\n" + + EnumChatFormatting.RED + " Flaming Worms: " + nf.format(FishingTracker.flamingWormsSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Blazes: " + nf.format(FishingTracker.lavaBlazesSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Pigmen: " + nf.format(FishingTracker.lavaPigmenSession) + "\n" + + EnumChatFormatting.GOLD + " Zombie Miners: " + nf.format(FishingTracker.zombieMinersSession) + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); + + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Crystal Hollows Fishing Summary:\n" + + EnumChatFormatting.BLUE + " Water Worms: " + nf.format(FishingTracker.waterWorms) + "\n" + + EnumChatFormatting.GREEN + " Poisoned Water Worms: " + nf.format(FishingTracker.poisonedWaterWorms) + "\n" + + EnumChatFormatting.RED + " Flaming Worms: " + nf.format(FishingTracker.flamingWorms) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Blazes: " + nf.format(FishingTracker.lavaBlazes) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Lava Pigmen: " + nf.format(FishingTracker.lavaPigmen) + "\n" + + EnumChatFormatting.GOLD + " Zombie Miners: " + nf.format(FishingTracker.zombieMiners) + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------")); } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 2c5c947..cca7dda 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -238,6 +238,12 @@ public class ResetLootCommand extends CommandBase { FishingTracker.werewolfsSession = 0; FishingTracker.phantomFishersSession = 0; FishingTracker.grimReapersSession = 0; + FishingTracker.waterWorms = 0; + FishingTracker.poisonedWaterWorms = 0; + FishingTracker.flamingWorms = 0; + FishingTracker.lavaBlazes = 0; + FishingTracker.lavaPigmen = 0; + FishingTracker.zombieMiners = 0; 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 c54f943..cf329aa 100644 --- a/src/main/java/me/Danker/features/loot/FishingTracker.java +++ b/src/main/java/me/Danker/features/loot/FishingTracker.java @@ -47,6 +47,13 @@ public class FishingTracker { public static int werewolfs; public static int phantomFishers; public static int grimReapers; + // CH Fishing + public static int waterWorms; + public static int poisonedWaterWorms; + public static int flamingWorms; + public static int lavaBlazes; + public static int lavaPigmen; + public static int zombieMiners; // Fishing public static int seaCreaturesSession = 0; @@ -87,6 +94,13 @@ public class FishingTracker { public static int werewolfsSession = 0; public static int phantomFishersSession = 0; public static int grimReapersSession = 0; + // CH Fishing + public static int waterWormsSession = 0; + public static int poisonedWaterWormsSession = 0; + public static int flamingWormsSession = 0; + public static int lavaBlazesSession = 0; + public static int lavaPigmenSession = 0; + public static int zombieMinersSession = 0; @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { @@ -252,6 +266,36 @@ public class FishingTracker { grimReapersSession++; ConfigHandler.writeIntConfig("fishing", "grimReaper", grimReapers); increaseSeaCreatures(); + } else if (message.contains("A Water Worm surfaces")) { + waterWorms++; + waterWormsSession++; + ConfigHandler.writeIntConfig("fishing", "waterWorm", waterWorms); + increaseSeaCreatures(); + } else if (message.contains("A Poisoned Water Worm surfaces")) { + poisonedWaterWorms++; + poisonedWaterWormsSession++; + ConfigHandler.writeIntConfig("fishing", "poisonedWaterWorm", poisonedWaterWorms); + increaseSeaCreatures(); + } else if (message.contains("A flaming worm surfaces from the depths")) { + flamingWorms++; + flamingWormsSession++; + ConfigHandler.writeIntConfig("fishing", "flamingWorm", flamingWorms); + increaseSeaCreatures(); + } else if (message.contains("A Lava Blaze has surfaced from the depths")) { + lavaBlazes++; + lavaBlazesSession++; + ConfigHandler.writeIntConfig("fishing", "lavaBlaze", lavaBlazes); + increaseSeaCreatures(); + } else if (message.contains("A Lava Pigman arose from the depths")) { + lavaPigmen++; + lavaPigmenSession++; + ConfigHandler.writeIntConfig("fishing", "lavaPigman", lavaPigmen); + increaseSeaCreatures(); + } else if (message.contains("A Zombie Miner surfaces")) { + zombieMiners++; + zombieMinersSession++; + ConfigHandler.writeIntConfig("fishing", "zombieMiner", zombieMiners); + increaseSeaCreatures(); } } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 1878b47..812108b 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -680,6 +680,50 @@ public class LootDisplay { EnumChatFormatting.GOLD + nf.format(FishingTracker.phantomFishersSession) + "\n" + EnumChatFormatting.GOLD + nf.format(FishingTracker.grimReapersSession); break; + case "fishing_ch": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.BLUE + "Water Worms:\n" + + EnumChatFormatting.GREEN + "Poison Water Worms:\n" + + EnumChatFormatting.RED + "Flaming Worms:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Blazes:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Pigmen:\n" + + EnumChatFormatting.GOLD + "Zombie Miners:"; + countText = EnumChatFormatting.AQUA + nf.format(FishingTracker.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(FishingTracker.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.greatCatches) + "\n" + + EnumChatFormatting.BLUE + nf.format(FishingTracker.waterWorms) + "\n" + + EnumChatFormatting.GREEN + nf.format(FishingTracker.poisonedWaterWorms) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.flamingWorms) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaBlazes) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaPigmen) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.zombieMiners); + break; + case "fishing_ch_session": + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.BLUE + "Water Worms:\n" + + EnumChatFormatting.GREEN + "Poison Water Worms:\n" + + EnumChatFormatting.RED + "Flaming Worms:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Blazes:\n" + + EnumChatFormatting.DARK_PURPLE + "Lava Pigmen:\n" + + EnumChatFormatting.GOLD + "Zombie Miners:"; + countText = EnumChatFormatting.AQUA + nf.format(FishingTracker.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(FishingTracker.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.greatCatchesSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(FishingTracker.waterWormsSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(FishingTracker.poisonedWaterWormsSession) + "\n" + + EnumChatFormatting.RED + nf.format(FishingTracker.flamingWormsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaBlazesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(FishingTracker.lavaPigmenSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(FishingTracker.zombieMinersSession); + break; case "mythological": dropsText = EnumChatFormatting.GOLD + "Coins:\n" + EnumChatFormatting.WHITE + "Griffin Feathers:\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index c7af0da..6edffa9 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -7,6 +7,7 @@ import me.Danker.gui.buttons.FeatureButton; import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -274,8 +275,7 @@ public class DankerGui extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); String pageText = "Page: " + page + "/" + (int) Math.ceil(foundButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(pageText, width, 10, 1D); for (GuiButton button : this.buttonList) { if (button instanceof FeatureButton && button.isMouseOver()) { diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 06239b1..4da92c6 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -4,6 +4,7 @@ import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -26,7 +27,7 @@ public class DisplayGui extends GuiScreen { private GuiButton fishingWinter; private GuiButton fishingFestival; private GuiButton fishingSpooky; - private GuiButton mythological; + private GuiButton fishingCH; private GuiButton catacombsF1; private GuiButton catacombsF2; private GuiButton catacombsF3; @@ -35,6 +36,7 @@ public class DisplayGui extends GuiScreen { private GuiButton catacombsF6; private GuiButton catacombsF7; private GuiButton catacombsMM; + private GuiButton mythological; private GuiButton ghost; @Override @@ -54,16 +56,15 @@ public class DisplayGui extends GuiScreen { showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off"); auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); - zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.3), 100, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.3), 100, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 100, 20, "Wolf"); - enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.3), 100, 20, "Enderman"); - fishing = new GuiButton(0, width / 2 - 230, (int) (height * 0.4), 100, 20, "Fishing"); - fishingWinter = new GuiButton(0, width / 2 - 110, (int) (height * 0.4), 100, 20, "Fishing Winter"); - fishingFestival = new GuiButton(0, width / 2 + 10, (int) (height * 0.4), 100, 20, "Fishing Festival"); - fishingSpooky = new GuiButton(0, width / 2 + 130, (int) (height * 0.4), 100, 20, "Fishing Spooky"); - mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), 95, 20, "Mythological"); - ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 95, 20, "Ghost"); + zombie = new GuiButton(0, width / 2 - 230, (int) (height * 0.35), 100, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 110, (int) (height * 0.35), 100, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.35), 100, 20, "Wolf"); + enderman = new GuiButton(0, width / 2 + 130, (int) (height * 0.35), 100, 20, "Enderman"); + fishing = new GuiButton(0, width / 2 - 270, (int) (height * 0.5), 100, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 160, (int) (height * 0.5), 100, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 - 50, (int) (height * 0.5), 100, 20, "Fishing Festival"); + fishingSpooky = new GuiButton(0, width / 2 + 60, (int) (height * 0.5), 100, 20, "Fishing Spooky"); + fishingCH = new GuiButton(0, width / 2 + 170, (int) (height * 0.5), 100, 20, "CH Fishing"); 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"); @@ -72,6 +73,8 @@ public class DisplayGui extends GuiScreen { catacombsF6 = new GuiButton(0, width / 2 + 65, (int) (height * 0.65), 50, 20, "F6"); catacombsF7 = new GuiButton(0, width / 2 + 125, (int) (height * 0.65), 50, 20, "F7"); catacombsMM = new GuiButton(0, width / 2 + 185, (int) (height * 0.65), 50, 20, "MM"); + mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 95, 20, "Mythological"); + ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.8), 95, 20, "Ghost"); this.buttonList.add(showSession); this.buttonList.add(off); @@ -84,7 +87,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(fishingWinter); this.buttonList.add(fishingFestival); this.buttonList.add(fishingSpooky); - this.buttonList.add(mythological); + this.buttonList.add(fishingCH); this.buttonList.add(catacombsF1); this.buttonList.add(catacombsF2); this.buttonList.add(catacombsF3); @@ -93,6 +96,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(catacombsF6); this.buttonList.add(catacombsF7); this.buttonList.add(catacombsMM); + this.buttonList.add(mythological); this.buttonList.add(ghost); this.buttonList.add(goBack); } @@ -100,20 +104,13 @@ public class DisplayGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - Minecraft mc = Minecraft.getMinecraft(); - - String displayText; - if (LootDisplay.auto) { - displayText = "Current Display: auto"; - } else { - displayText = "Current Display: " + LootDisplay.display; - } - int displayWidth = mc.fontRendererObj.getStringWidth(displayText); - new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); - - String catacombsTitleText = "Catacombs Dungeon"; - int catacombsTitleWidth = mc.fontRendererObj.getStringWidth(catacombsTitleText); - new TextRenderer(mc, catacombsTitleText, width / 2 - catacombsTitleWidth / 2, (int) (height * 0.6), 1D); + + String displayText = LootDisplay.auto ? "Current Display: auto" : "Current Display: " + LootDisplay.display; + RenderUtils.drawCenteredText(displayText, width, 10, 1D); + RenderUtils.drawCenteredText("Slayer", width, (int) (height * 0.3), 1D); + RenderUtils.drawCenteredText("Fishing", width, (int) (height * 0.45), 1D); + RenderUtils.drawCenteredText("Catacombs Dungeon", width, (int) (height * 0.6), 1D); + RenderUtils.drawCenteredText("Misc", width, (int) (height * 0.75), 1D); super.drawScreen(mouseX, mouseY, partialTicks); } @@ -146,6 +143,8 @@ public class DisplayGui extends GuiScreen { setDisplay("fishing_festival"); } else if (button == fishingSpooky) { setDisplay("fishing_spooky"); + } else if (button == fishingCH) { + setDisplay("fishing_ch"); } else if (button == mythological) { setDisplay("mythological"); } else if (button == catacombsF1) { diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index c203b8a..a5674f8 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -5,6 +5,7 @@ import me.Danker.commands.ToggleCommand; import me.Danker.features.BlockWrongSlayer; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -97,8 +98,7 @@ public class OnlySlayerGui extends GuiScreen { } else { displayText = "Only Allow Slayer: " + BlockWrongSlayer.onlySlayerName + " " + BlockWrongSlayer.onlySlayerNumber; } - int displayWidth = mc.fontRendererObj.getStringWidth(displayText); - new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(displayText, width, 10, 1D); super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java index 290310f..84cc2e3 100644 --- a/src/main/java/me/Danker/gui/SkillTrackerGui.java +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -4,6 +4,7 @@ import me.Danker.DankersSkyblockMod; import me.Danker.features.SkillTracker; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -50,6 +51,7 @@ public class SkillTrackerGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); + String stateText = ""; if (SkillTracker.skillStopwatch.isStarted() && !SkillTracker.skillStopwatch.isSuspended()) { stateText = "Timer: Running"; @@ -59,8 +61,8 @@ public class SkillTrackerGui extends GuiScreen { if (!SkillTracker.showSkillTracker) { stateText += " (Hidden)"; } - int stateTextWidth = mc.fontRendererObj.getStringWidth(stateText); - new TextRenderer(mc, stateText, width / 2 - stateTextWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(stateText, width, 10, 1D); + super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/me/Danker/gui/WarningGui.java b/src/main/java/me/Danker/gui/WarningGui.java index db0c21b..bb37b83 100644 --- a/src/main/java/me/Danker/gui/WarningGui.java +++ b/src/main/java/me/Danker/gui/WarningGui.java @@ -1,10 +1,12 @@ package me.Danker.gui; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; public class WarningGui extends GuiScreen { private GuiButton close; @@ -34,15 +36,11 @@ public class WarningGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - String text0 = "§cWARNING!§0"; - int text0Width = mc.fontRendererObj.getStringWidth(text0); - new TextRenderer(mc, text0, (int)(width * 0.45) - text0Width / 2, (int) (height * 0.1), 2 ); - String text1 = "You are using SpiderFrog's Old Animations mod."; - int text1Width = mc.fontRendererObj.getStringWidth(text1); - new TextRenderer(mc, text1, width / 2 - text1Width / 2, (int) (height * 0.3), 1D ); - String text2 = "This mod breaks Danker's Skyblock Mod."; - int text2Width = mc.fontRendererObj.getStringWidth(text2); - new TextRenderer(mc, text2, width / 2 - text2Width / 2, (int) (height * 0.4), 1D); + + RenderUtils.drawCenteredText(EnumChatFormatting.RED + "WARNING!", (int) (width * 0.9), (int) (height * 0.1), 2D); + RenderUtils.drawCenteredText("You are using SpiderFrog's Old Animations mod.", width, (int) (height * 0.3), 1D); + RenderUtils.drawCenteredText("This mod breaks Danker's Skyblock Mod.", width, (int) (height * 0.4), 1D); + super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java index 06dfd91..034ad79 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertActionGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertActionGui.java @@ -2,6 +2,7 @@ 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; import net.minecraft.client.gui.GuiButton; @@ -55,6 +56,7 @@ public class AlertActionGui extends GuiScreen { Alerts.Alert alert = Alerts.alerts.get(id); + RenderUtils.drawCenteredText(alert.alert, width, 10, 1D); String alertText = alert.alert; int textWidth = mc.fontRendererObj.getStringWidth(alertText); new TextRenderer(mc, alertText, width / 2 - textWidth / 2, 10, 1D); diff --git a/src/main/java/me/Danker/gui/alerts/AlertsGui.java b/src/main/java/me/Danker/gui/alerts/AlertsGui.java index 3ccd869..8eaedca 100644 --- a/src/main/java/me/Danker/gui/alerts/AlertsGui.java +++ b/src/main/java/me/Danker/gui/alerts/AlertsGui.java @@ -6,6 +6,7 @@ import me.Danker.gui.DankerGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; @@ -78,8 +79,7 @@ public class AlertsGui extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(pageText, width, 10, 1D); } @Override diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java index f792892..30447a0 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java @@ -3,6 +3,7 @@ package me.Danker.gui.crystalhollowwaypoints; import me.Danker.DankersSkyblockMod; import me.Danker.features.CrystalHollowWaypoints; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -63,9 +64,7 @@ public class CrystalHollowWaypointActionGui extends GuiScreen { CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); - String waypointText = waypoint.location + " @ " + waypoint.getPos(); - int pageWidth = mc.fontRendererObj.getStringWidth(waypointText); - new TextRenderer(mc, waypointText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(waypoint.location + " @ " + waypoint.getPos(), width, 10, 1D); } @Override diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java index a3d0452..2331ec0 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java @@ -7,6 +7,7 @@ import me.Danker.gui.DankerGui; import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -94,8 +95,7 @@ public class CrystalHollowWaypointsGui extends GuiScreen { super.drawScreen(mouseX, mouseY, partialTicks); String pageText = "Page: " + page + "/" + (int) Math.ceil(allButtons.size() / 7D); - int pageWidth = mc.fontRendererObj.getStringWidth(pageText); - new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + RenderUtils.drawCenteredText(pageText, width, 10, 1D); } @Override diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 112d86d..e5ed372 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -417,6 +417,13 @@ public class ConfigHandler { FishingTracker.werewolfs = initInt("fishing", "werewolf", 0); FishingTracker.phantomFishers = initInt("fishing", "phantomFisher", 0); FishingTracker.grimReapers = initInt("fishing", "grimReaper", 0); + // CH Fishing + FishingTracker.waterWorms = initInt("fishing", "waterWorm", 0); + FishingTracker.poisonedWaterWorms = initInt("fishing", "poisonedWaterWorm", 0); + FishingTracker.flamingWorms = initInt("fishing", "flamingWorm", 0); + FishingTracker.lavaBlazes = initInt("fishing", "lavaBlaze", 0); + FishingTracker.lavaPigmen = initInt("fishing", "lavaPigman", 0); + FishingTracker.zombieMiners = initInt("fishing", "zombieMiner", 0); // Mythological MythologicalTracker.mythCoins = initDouble("mythological", "coins", 0); diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index f117969..50b9786 100644 --- a/src/main/java/me/Danker/utils/RenderUtils.java +++ b/src/main/java/me/Danker/utils/RenderUtils.java @@ -363,4 +363,10 @@ public class RenderUtils { GlStateManager.disableRescaleNormal(); } + public static void drawCenteredText(String text, int screenWidth, int height, double scale) { + Minecraft mc = Minecraft.getMinecraft(); + int textWidth = mc.fontRendererObj.getStringWidth(text); + new TextRenderer(mc, text, screenWidth / 2 - textWidth / 2, height, scale); + } + } |