Skip to content

Commit 883120f

Browse files
committed
Fix ModularGuiContainer background rendering overtop the GUI
1 parent bd5cad0 commit 883120f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/codechicken/lib/gui/modular/ModularGuiContainer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
7676
imageHeight = (int) root.getValue(GeoParam.HEIGHT);
7777

7878
if (modularGui.renderBackground()) {
79-
renderBackground(graphics, mouseX, mouseY, partialTicks);
79+
//Called here to ensure background renders before modularGui elements.
80+
super.renderBackground(graphics, mouseX, mouseY, partialTicks);
8081
}
81-
GuiRender render = GuiRender.convert(graphics);//modularGui.createRender(graphics.bufferSource());
82+
GuiRender render = GuiRender.convert(graphics);
8283
modularGui.render(render, partialTicks);
8384

8485
super.render(graphics, mouseX, mouseY, partialTicks);
@@ -88,6 +89,11 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
8889
}
8990
}
9091

92+
@Override
93+
public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
94+
//Stubbed to avoid the above super.render() call from rendering the background again.
95+
}
96+
9197
protected boolean handleFloatingItemRender(GuiRender render, int mouseX, int mouseY) {
9298
if (modularGui.vanillaSlotRendering()) return false;
9399
boolean ret = false;

0 commit comments

Comments
 (0)