Skip to content

Commit

Permalink
UScreen: Fix background drawing on 1.21.2+
Browse files Browse the repository at this point in the history
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).

GitHub: #89
  • Loading branch information
Johni0702 authored Jan 31, 2025
1 parent a5351a7 commit 68dd0e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/gg/essential/universal/UScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 68dd0e2

Please sign in to comment.