Fix screen layering and re-add the test. (#9978)

This commit is contained in:
Mysticdrew authored and GitHub committed 2024-05-20 11:49:41 -07:00
1 parent 5da16e6719
commit e8f1b7ed6d
3 files changed
+5 -5

No files matched your search

@@ -31,13 +31,13 @@
0.0F,
1000.0F,
- 21000.0F
+ 21000.0f
+ net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()
);
RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z);
Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack();
matrix4fstack.pushMatrix();
- matrix4fstack.translation(0.0F, 0.0F, -11000.0F);
+ matrix4fstack.translation(0.0F, 0.0F, 1000F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
+ matrix4fstack.translation(0.0F, 0.0F, 10000F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
@@ -247,10 +247,10 @@ public class ForgeHooksClient {
}
public static float getGuiFarPlane() {
// 1000 units for the overlay background,
// 11000 units for the overlay background,
// and 10000 units for each layered Screen,
return 1000.0F + 10000.0F * (1 + guiLayers.size());
return 11000.0F + 10000.0F * (1 + guiLayers.size());
}
public static boolean onClientPauseChangePre(boolean pause) {
@@ -383,7 +383,7 @@ public class ForgeHooksClient {
guiLayers.forEach(layer -> {
// Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted.
drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick);
guiGraphics.pose().translate(0,0,2000);
guiGraphics.pose().translate(0, 0, 10000);
});
drawScreenInternal(screen, guiGraphics, mouseX, mouseY, partialTick);
guiGraphics.pose().popPose();