blob: 3f0562f0d82b67c25153571c9f9afdf1cb8b4c06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.GuiRenderEvent
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.client.gui.inventory.GuiInventory
import net.minecraft.client.renderer.GlStateManager
import net.minecraftforge.client.event.GuiScreenEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class RenderGuiData {
@SubscribeEvent
fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) {
// if (!ProfileStorage.loaded) return
if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return
if (GuiEditManager.isInGui()) return
GuiRenderEvent.GameOverlayRenderEvent().postAndCatch()
}
@SubscribeEvent
fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) {
// if (!ProfileStorage.loaded) return
if (GuiEditManager.isInGui()) return
val currentScreen = Minecraft.getMinecraft().currentScreen ?: return
if (currentScreen !is GuiInventory && currentScreen !is GuiChest) return
GlStateManager.pushMatrix()
GlStateManager.enableDepth()
if (GuiEditManager.isInGui()) {
GuiRenderEvent.GameOverlayRenderEvent().postAndCatch()
}
GuiRenderEvent.ChestBackgroundRenderEvent().postAndCatch()
GlStateManager.popMatrix()
}
}
|