package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule 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() } } }