Skip to content

Commit

Permalink
changed a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed May 4, 2024
1 parent 039a62f commit 806085a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ class SkyHanniMod {
loadModule(VisitorListener())
loadModule(VisitorRewardWarning())
loadModule(OwnInventoryData())
loadModule(ScreenData)
loadModule(HighlightVisitorsOutsideOfGarden())
loadModule(GuiEditManager())
loadModule(GetFromSackAPI)
Expand Down Expand Up @@ -554,7 +555,6 @@ class SkyHanniMod {
loadModule(ContributorManager)
loadModule(TabComplete)
loadModule(HypixelBazaarFetcher)
loadModule(ScreenData)

// APIs
loadModule(BazaarApi())
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/at/hannibal2/skyhanni/data/ScreenData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent


object ScreenData {
private var isScreenOpen = false
private var wasOpen = false

@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (!isScreenOpen && Minecraft.getMinecraft().currentScreen != null) {
isScreenOpen = true
} else if (isScreenOpen && Minecraft.getMinecraft().currentScreen == null) {
isScreenOpen = false
val isOpen = Minecraft.getMinecraft().currentScreen != null
if (wasOpen == isOpen) return
wasOpen = isOpen
if (!wasOpen) {
InventoryCloseEvent(false).postAndCatch()
}
}
Expand Down

0 comments on commit 806085a

Please sign in to comment.