blob: 2b64ed1ab33df2facd681a9579488ad5b3de471f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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()
}
}
}
|