diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-12-30 00:48:09 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-12-30 00:48:09 +0100 |
commit | ace804d85c79caaaf7d6ed9f6bd90466c947b6b2 (patch) | |
tree | b0e170d824836072281526027bafdd46612dd710 /src/main/java/at/hannibal2/skyhanni/features | |
parent | e50d8d3b7d3f2682744b5b9ee98d248ea5f0ce5b (diff) | |
download | skyhanni-ace804d85c79caaaf7d6ed9f6bd90466c947b6b2.tar.gz skyhanni-ace804d85c79caaaf7d6ed9f6bd90466c947b6b2.tar.bz2 skyhanni-ace804d85c79caaaf7d6ed9f6bd90466c947b6b2.zip |
Adds a visual highlight to the Croesus inventory that shows what chests have not yet been opened.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt | 40 |
1 files changed, 40 insertions, 0 deletions
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 |