summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-04-04 20:31:39 +0200
committerGitHub <noreply@github.com>2024-04-04 20:31:39 +0200
commitb9c0aaa585a913d5c139c8e5aa7437925b1acfa2 (patch)
treebf75aeee89d28934a5f5de37da13da4b9c3af765 /src/main/java/at/hannibal2/skyhanni/data
parent704b90b4a25a88cb3ad33fa77a1b9423caaf472d (diff)
downloadskyhanni-b9c0aaa585a913d5c139c8e5aa7437925b1acfa2.tar.gz
skyhanni-b9c0aaa585a913d5c139c8e5aa7437925b1acfa2.tar.bz2
skyhanni-b9c0aaa585a913d5c139c8e5aa7437925b1acfa2.zip
Improvement: Anita and SkyMart highlight (#1118)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HighlightOnHoverSlot.kt36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HighlightOnHoverSlot.kt b/src/main/java/at/hannibal2/skyhanni/data/HighlightOnHoverSlot.kt
new file mode 100644
index 000000000..9e99fdbae
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/HighlightOnHoverSlot.kt
@@ -0,0 +1,36 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.InventoryCloseEvent
+import at.hannibal2.skyhanni.events.InventoryOpenEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object HighlightOnHoverSlot {
+ val currentSlots = mutableMapOf<Pair<Int, Int>, List<Int>>()
+
+ @SubscribeEvent
+ fun onInventoryOpen(event: InventoryOpenEvent) {
+ currentSlots.clear()
+ }
+
+ @SubscribeEvent
+ fun onInventoryClose(event: InventoryCloseEvent) {
+ currentSlots.clear()
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOW)
+ fun onDrawBackground(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ val list = currentSlots.flatMapTo(mutableSetOf()) { it.value }
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ if (slot.slotNumber in list) {
+ slot highlight LorenzColor.GREEN
+ }
+ }
+ }
+}