From 145d7885e93a4e27715afaf7295859b1dab19b45 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Wed, 15 Jan 2025 07:06:01 +0100 Subject: [PATCH] UScreen: Fix background drawing on 1.21.2+ As of 1.21.2 MC's DrawContext will now by default buffer all drawn quads and only flush when strictly necessary. This however requires that everyone is in on the batching and has all their calls batched as well, otherwise buffered stuff will get rendered much later than it was supposed to. E.g. the vanilla background (much more obvious with the Programmer Art pack which brings back the dirt background) will be rendered on top of most of the Elementa gui. Ideally we'd get in on the batching too, but that's quite the task, so for the time being this commit fixes the issue by explictly flushing after every time we pass the DrawContext to a vanilla method (i.e. any time something could have been buffered). --- src/main/kotlin/gg/essential/universal/UScreen.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/gg/essential/universal/UScreen.kt b/src/main/kotlin/gg/essential/universal/UScreen.kt index 797fd14..55196a8 100644 --- a/src/main/kotlin/gg/essential/universal/UScreen.kt +++ b/src/main/kotlin/gg/essential/universal/UScreen.kt @@ -56,6 +56,9 @@ abstract class UScreen( //$$ mc.positionMatrix.set(uc.model) //$$ mc.normalMatrix.set(uc.normal) //$$ block(context) + //#if MC>=12102 + //$$ context.draw() + //#endif //$$ context.matrices.pop() //$$ } //#endif