From ace804d85c79caaaf7d6ed9f6bd90466c947b6b2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 30 Dec 2022 00:48:09 +0100 Subject: Adds a visual highlight to the Croesus inventory that shows what chests have not yet been opened. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 + .../skyhanni/config/features/Dungeon.java | 12 +++++-- .../dungeon/CroesusUnopenedChestTracker.kt | 40 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 0af68df64..eccfc78c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -166,6 +166,7 @@ public class SkyHanniMod { registerEvent(new HighlightBonzoMasks()); registerEvent(new DungeonLevelColor()); registerEvent(new BazaarCancelledBuyOrderClipboard()); + registerEvent(new CroesusUnopenedChestTracker()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java index f706446a1..074d4e0f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java @@ -69,7 +69,7 @@ public class Dungeon { @Expose @ConfigOption(name = "Highlight Deathmites", desc = "Highlight deathmites in dungeon in red color.") @ConfigEditorBoolean - public boolean highlightDeathmites = false; + public boolean highlightDeathmites = true; @ConfigOption(name = "Object Hider", desc = "Hide various things in dungeon.") @ConfigEditorAccordion(id = 3) @@ -109,7 +109,7 @@ public class Dungeon { @ConfigOption(name = "Hide Skeleton Skull", desc = "Hide skeleton skulls laying around in dungeon.") @ConfigEditorBoolean @ConfigAccordionId(id = 3) - public boolean hideSkeletonSkull = false; + public boolean hideSkeletonSkull = true; @Expose @ConfigOption(name = "Hide Healer Orbs", desc = "Hides the damage, ability damage and defensive orbs that spawn when the healer kills mobs.") @@ -163,5 +163,11 @@ public class Dungeon { @ConfigOption(name = "Moving Skeleton Skulls", desc = "Highlight Skeleton Skulls when combining into a " + "Skeletor in orange color (not useful combined with feature Hide Skeleton Skull)") @ConfigEditorBoolean - public boolean highlightSkeletonSkull = false; + public boolean highlightSkeletonSkull = true; + + @Expose + @ConfigOption(name = "Croesus Unopened Chest Tracker", desc = "Adds a visual highlight to the Croesus inventory that " + + "shows what chests have not yet been opened.") + @ConfigEditorBoolean + public boolean croesusUnopenedChestTracker = true; } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt new file mode 100644 index 000000000..ae5d5511d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt @@ -0,0 +1,40 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CroesusUnopenedChestTracker { + + @SubscribeEvent(priority = EventPriority.LOW) + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.dungeon.croesusUnopenedChestTracker) return + + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + if (chestName == "Croesus") { + for (slot in InventoryUtils.getItemsInOpenChest()) { + val stack = slot.stack + val lore = stack.getLore() + if (lore.any { it.contains("Click to view") }) { + if (!lore.any { it.contains("Chests have been opened!") }) { + slot highlight LorenzColor.GREEN + } + } + } + } + + } +} \ No newline at end of file -- cgit