Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Overlay Rendering Layer #953

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/data/RenderData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class RenderData {
if (!SkyHanniDebugsAndTests.globalRender) return
if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return

GlStateManager.translate(0f,0f,-3f)
GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch()
GlStateManager.translate(0f,0f,3f)
}

@SubscribeEvent
Expand All @@ -38,7 +40,9 @@ class RenderData {
GlStateManager.enableDepth()

if (GuiEditManager.isInGui()) {
GlStateManager.translate(0f,0f,-3f)
GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch()
GlStateManager.translate(0f,0f,3f)
}

GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch()
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import io.github.moulberry.moulconfig.internal.TextRenderUtils
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.renderer.GlStateManager
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
Expand Down Expand Up @@ -57,7 +56,7 @@ class TitleManager {
endTime = SimpleTimeMark.farPast()
}

@SubscribeEvent(priority = EventPriority.LOWEST)
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (endTime.isInPast()) return

Expand All @@ -70,7 +69,7 @@ class TitleManager {
val renderer = Minecraft.getMinecraft().fontRendererObj

GlStateManager.pushMatrix()
GlStateManager.translate((width / 2).toFloat(), (height / heightModifier).toFloat(), 0.0f)
GlStateManager.translate((width / 2).toFloat(), (height / heightModifier).toFloat(), 3.0f)
GlStateManager.scale(fontSizeModifier, fontSizeModifier, fontSizeModifier)
TextRenderUtils.drawStringCenteredScaledMaxWidth(display, renderer, 0f, 0f, true, 75, 0)
GlStateManager.popMatrix()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.Gui
import net.minecraft.client.gui.GuiChat
import net.minecraft.client.gui.inventory.GuiEditSign
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.item.ItemStack
Expand Down Expand Up @@ -233,8 +232,6 @@ interface Renderable {

override fun render(posX: Int, posY: Int) {
GlStateManager.pushMatrix()
if (Minecraft.getMinecraft().currentScreen is GuiChat)
GlStateManager.translate(0F, 0F, -3F)
any.renderOnScreen(0F, 0F, scaleMultiplier = scale)
GlStateManager.popMatrix()
}
Expand Down
Loading