UScreen: Fix background drawing on 1.21.2+ #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).
For additional context see this conversation in the Essential Discord.
Note: This issue is masked when running with Essential because Essential already happens calls
draw
from one of its mixins. It can be made apparent again by installing ImmediatelyFast which uses a different VertexConsumerProvider for gui rendering making Essential's draw call on the vanilla VertexConsumerProvider ineffective.