diff options
author | Mikecraft1224 <85994411+Mikecraft1224@users.noreply.github.com> | 2024-05-06 17:30:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 17:30:05 +0200 |
commit | 82370ca380c81aa06aa10aef483147778be15253 (patch) | |
tree | dd867433fc526f29d71e34cc603b7512778676c9 /src/main | |
parent | 3132204c8e586c9b3fb66260032a0c867974e7e5 (diff) | |
download | skyhanni-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')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/ScreenData.kt | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index b17773c4b..219745a33 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -48,6 +48,7 @@ import at.hannibal2.skyhanni.data.QuiverAPI import at.hannibal2.skyhanni.data.RenderData import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.data.ScreenData import at.hannibal2.skyhanni.data.SkillExperience import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.data.TitleData @@ -518,6 +519,7 @@ class SkyHanniMod { loadModule(VisitorListener()) loadModule(VisitorRewardWarning()) loadModule(OwnInventoryData()) + loadModule(ScreenData) loadModule(HighlightVisitorsOutsideOfGarden()) loadModule(GuiEditManager()) loadModule(GetFromSackAPI) 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() + } + } +} |