diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/FilletMagmafish.java | 139 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 7 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 16 |
6 files changed, 165 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 1b428b6..5d71b31 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -127,6 +127,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new EndOfFarmAlert()); MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); + MinecraftForge.EVENT_BUS.register(new FilletMagmafish()); MinecraftForge.EVENT_BUS.register(new FirePillarDisplay()); MinecraftForge.EVENT_BUS.register(new FishingSpawnAlerts()); MinecraftForge.EVENT_BUS.register(new GemstonesLore()); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 00b41f3..aefb979 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -67,6 +67,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean fishingAlert; public static boolean minionLastCollected; public static boolean showTrophyCompletion; + public static boolean showTotalMagmafish; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; diff --git a/src/main/java/me/Danker/features/FilletMagmafish.java b/src/main/java/me/Danker/features/FilletMagmafish.java new file mode 100644 index 0000000..06a35dc --- /dev/null +++ b/src/main/java/me/Danker/features/FilletMagmafish.java @@ -0,0 +1,139 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.events.ModInitEvent; +import me.Danker.utils.RenderUtils; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.text.NumberFormat; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; + +public class FilletMagmafish { + + static Map<String, Integer> fillet = new HashMap<>(); + static int total = 0; + + @SubscribeEvent + public void init(ModInitEvent event) { + fillet.put("SULPHER_SKITTER_BRONZE", 40); + fillet.put("SULPHER_SKITTER_SILVER", 60); + fillet.put("SULPHER_SKITTER_GOLD", 80); + fillet.put("SULPHER_SKITTER_DIAMOND", 120); + fillet.put("OBFUSCATED_FISH_1_BRONZE", 16); + fillet.put("OBFUSCATED_FISH_1_SILVER", 24); + fillet.put("OBFUSCATED_FISH_1_GOLD", 32); + fillet.put("OBFUSCATED_FISH_1_DIAMOND", 48); + fillet.put("STEAMING_HOT_FLOUNDER_BRONZE", 20); + fillet.put("STEAMING_HOT_FLOUNDER_SILVER", 28); + fillet.put("STEAMING_HOT_FLOUNDER_GOLD", 40); + fillet.put("STEAMING_HOT_FLOUNDER_DIAMOND", 60); + fillet.put("GUSHER_BRONZE", 32); + fillet.put("GUSHER_SILVER", 48); + fillet.put("GUSHER_GOLD", 64); + fillet.put("GUSHER_DIAMOND", 96); + fillet.put("BLOBFISH_BRONZE", 4); + fillet.put("BLOBFISH_SILVER", 8); + fillet.put("BLOBFISH_GOLD", 12); + fillet.put("BLOBFISH_DIAMOND", 16); + fillet.put("OBFUSCATED_FISH_2_BRONZE", 40); + fillet.put("OBFUSCATED_FISH_2_SILVER", 60); + fillet.put("OBFUSCATED_FISH_2_GOLD", 80); + fillet.put("OBFUSCATED_FISH_2_DIAMOND", 120); + fillet.put("SLUGFISH_BRONZE", 40); + fillet.put("SLUGFISH_SILVER", 60); + fillet.put("SLUGFISH_GOLD", 80); + fillet.put("SLUGFISH_DIAMOND", 120); + fillet.put("FLYFISH_BRONZE", 32); + fillet.put("FLYFISH_SILVER", 48); + fillet.put("FLYFISH_GOLD", 64); + fillet.put("FLYFISH_DIAMOND", 96); + fillet.put("OBFUSCATED_FISH_3_BRONZE", 400); + fillet.put("OBFUSCATED_FISH_3_SILVER", 700); + fillet.put("OBFUSCATED_FISH_3_GOLD", 1000); + fillet.put("OBFUSCATED_FISH_3_DIAMOND", 1300); + fillet.put("LAVA_HORSE_BRONZE", 12); + fillet.put("LAVA_HORSE_SILVER", 16); + fillet.put("LAVA_HORSE_GOLD", 20); + fillet.put("LAVA_HORSE_DIAMOND", 24); + fillet.put("MANA_RAY_BRONZE", 40); + fillet.put("MANA_RAY_SILVER", 60); + fillet.put("MANA_RAY_GOLD", 80); + fillet.put("MANA_RAY_DIAMOND", 120); + fillet.put("VOLCANIC_STONEFISH_BRONZE", 20); + fillet.put("VOLCANIC_STONEFISH_SILVER", 28); + fillet.put("VOLCANIC_STONEFISH_GOLD", 40); + fillet.put("VOLCANIC_STONEFISH_DIAMOND", 60); + fillet.put("VANILLE_BRONZE", 80); + fillet.put("VANILLE_SILVER", 120); + fillet.put("VANILLE_GOLD", 160); + fillet.put("VANILLE_DIAMOND", 240); + fillet.put("SKELETON_FISH_BRONZE", 32); + fillet.put("SKELETON_FISH_SILVER", 48); + fillet.put("SKELETON_FISH_GOLD", 64); + fillet.put("SKELETON_FISH_DIAMOND", 96); + fillet.put("MOLDFIN_BRONZE", 32); + fillet.put("MOLDFIN_SILVER", 48); + fillet.put("MOLDFIN_GOLD", 64); + fillet.put("MOLDFIN_DIAMOND", 96); + fillet.put("SOUL_FISH_BRONZE", 32); + fillet.put("SOUL_FISH_SILVER", 48); + fillet.put("SOUL_FISH_GOLD", 64); + fillet.put("SOUL_FISH_DIAMOND", 96); + fillet.put("KARATE_FISH_BRONZE", 40); + fillet.put("KARATE_FISH_SILVER", 60); + fillet.put("KARATE_FISH_GOLD", 80); + fillet.put("KARATE_FISH_DIAMOND", 120); + fillet.put("GOLDEN_FISH_BRONZE", 400); + fillet.put("GOLDEN_FISH_SILVER", 700); + fillet.put("GOLDEN_FISH_GOLD", 1000); + fillet.put("GOLDEN_FISH_DIAMOND", 1300); + } + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + if (!ToggleCommand.showTotalMagmafish || !Utils.inSkyblock) return; + + if (event.gui instanceof GuiInventory) { + ItemStack[] inv = Minecraft.getMinecraft().thePlayer.inventory.mainInventory; + + for (ItemStack stack : inv) { + String id = Utils.getSkyblockItemID(stack); + if (id == null) continue; + + total += Optional.ofNullable(fillet.get(id)).orElse(0); + } + } else { + total = 0; + } + } + + @SubscribeEvent + public void onGuiScreenRender(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!ToggleCommand.showTotalMagmafish || !Utils.inSkyblock) return; + + if (event.gui instanceof GuiInventory) { + if (total == 0) return; + + NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + String display = EnumChatFormatting.BLUE + "Magmafish: " + nf.format(total); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int width = sr.getScaledWidth(); + int height = (sr.getScaledHeight() - 222) / 2 + 10; + + RenderUtils.drawCenteredText(display, width, height, 1D); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 9a8d283..f009d34 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -95,6 +95,7 @@ public class DankerGui extends GuiScreen { private GuiButton fishingAlert; private GuiButton minionLastCollected; private GuiButton showTrophyCompletion; + private GuiButton showTotalMagmafish; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -194,6 +195,7 @@ public class DankerGui extends GuiScreen { 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."); + showTotalMagmafish = new FeatureButton("Show Total Fillet Magmafish: " + Utils.getColouredBoolean(ToggleCommand.showTotalMagmafish), "Show total Magmafish you would get if you filleted all the trophy fish in your inventory."); allButtons.clear(); allButtons.add(changeDisplay); @@ -259,6 +261,7 @@ public class DankerGui extends GuiScreen { allButtons.add(fishingAlert); allButtons.add(minionLastCollected); allButtons.add(showTrophyCompletion); + allButtons.add(showTotalMagmafish); search.setText(initSearchText); search.setVisible(true); @@ -572,6 +575,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.showTrophyCompletion = !ToggleCommand.showTrophyCompletion; ConfigHandler.writeBooleanConfig("toggles", "ShowTrophyCompletion", ToggleCommand.showTrophyCompletion); showTrophyCompletion.displayString = "Show Trophy Fish Completion: " + Utils.getColouredBoolean(ToggleCommand.showTrophyCompletion); + } else if (button == showTotalMagmafish) { + ToggleCommand.showTotalMagmafish = !ToggleCommand.showTotalMagmafish; + ConfigHandler.writeBooleanConfig("toggles", "ShowTotalMagmafish", ToggleCommand.showTotalMagmafish); + showTotalMagmafish.displayString = "Show Total Fillet Magmafish: " + Utils.getColouredBoolean(ToggleCommand.showTotalMagmafish); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index c12b511..ccc3143 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -254,6 +254,7 @@ public class ConfigHandler { ToggleCommand.fishingAlert = initBoolean("toggles", "FishingAlert", false); ToggleCommand.minionLastCollected = initBoolean("toggles", "MinionLastCollected", false); ToggleCommand.showTrophyCompletion = initBoolean("toggles", "ShowTrophyCompletion", false); + ToggleCommand.showTotalMagmafish = initBoolean("toggles", "ShowTotalMagmafish", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 8791a43..7c92620 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -531,6 +531,22 @@ public class Utils { return newObj; } + // https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/utils/ItemUtils.java#L139-L148 + public static NBTTagCompound getExtraAttributes(ItemStack item) { + if (item == null || !item.hasTagCompound()) return null; + return item.getSubCompound("ExtraAttributes", false); + } + + // https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/utils/ItemUtils.java#L116-L131 + public static String getSkyblockItemID(ItemStack item) { + if (item == null) return null; + + NBTTagCompound extraAttributes = getExtraAttributes(item); + if (extraAttributes == null || !extraAttributes.hasKey("id", 8)) return null; + + return extraAttributes.getString("id"); + } + public enum DungeonFloor { NONE, E0, |