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 | 3beeb1124535101fc2f71b61d760065d15b0ec32 (patch) | |
| tree | b0e170d824836072281526027bafdd46612dd710 /src/main/java/at/hannibal2/skyhanni/features | |
| parent | a903a1dc50864f70887613d83bc4a654aa483d07 (diff) | |
| download | SkyHanni-3beeb1124535101fc2f71b61d760065d15b0ec32.tar.gz SkyHanni-3beeb1124535101fc2f71b61d760065d15b0ec32.tar.bz2 SkyHanni-3beeb1124535101fc2f71b61d760065d15b0ec32.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 |
