aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorMikecraft1224 <85994411+Mikecraft1224@users.noreply.github.com>2024-05-06 17:30:05 +0200
committerGitHub <noreply@github.com>2024-05-06 17:30:05 +0200
commit82370ca380c81aa06aa10aef483147778be15253 (patch)
treedd867433fc526f29d71e34cc603b7512778676c9 /src/main/java/at/hannibal2/skyhanni/data
parent3132204c8e586c9b3fb66260032a0c867974e7e5 (diff)
downloadskyhanni-82370ca380c81aa06aa10aef483147778be15253.tar.gz
skyhanni-82370ca380c81aa06aa10aef483147778be15253.tar.bz2
skyhanni-82370ca380c81aa06aa10aef483147778be15253.zip
Fixed highlights in inventory staying when exiting via NEU recipes (#1699)
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/ScreenData.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScreenData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScreenData.kt
new file mode 100644
index 000000000..194983695
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScreenData.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.events.InventoryCloseEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import net.minecraft.client.Minecraft
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object ScreenData {
+ private var wasOpen = false
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ val isOpen = Minecraft.getMinecraft().currentScreen != null
+ if (wasOpen == isOpen) return
+ wasOpen = isOpen
+ if (!wasOpen) {
+ InventoryCloseEvent(false).postAndCatch()
+ }
+ }
+}