|
7 | 7 | import java.util.Map; |
8 | 8 | import java.util.function.Consumer; |
9 | 9 |
|
10 | | -import org.jetbrains.annotations.Nullable; |
11 | | - |
12 | 10 | import net.minecraft.block.Block; |
13 | 11 | import net.minecraft.client.Minecraft; |
14 | 12 | import net.minecraft.client.gui.Gui; |
15 | 13 | import net.minecraft.client.renderer.OpenGlHelper; |
| 14 | +import net.minecraft.client.renderer.RenderHelper; |
16 | 15 | import net.minecraft.client.renderer.Tessellator; |
17 | 16 | import net.minecraft.entity.Entity; |
18 | 17 | import net.minecraft.init.Blocks; |
|
21 | 20 | import net.minecraft.util.ResourceLocation; |
22 | 21 | import net.minecraft.util.Vec3; |
23 | 22 |
|
| 23 | +import org.jetbrains.annotations.Nullable; |
24 | 24 | import org.joml.Vector3f; |
25 | 25 | import org.lwjgl.input.Mouse; |
26 | 26 | import org.lwjgl.opengl.GL11; |
@@ -949,6 +949,7 @@ public void render(RenderContext context) { |
949 | 949 | } |
950 | 950 | } |
951 | 951 |
|
| 952 | + restoreGuiRenderState(); |
952 | 953 | drawBottomControls(context, outerRect); |
953 | 954 |
|
954 | 955 | // Draw border AFTER the 3D content so border pixels always sit on top. |
@@ -981,6 +982,23 @@ public static LytRect updateCachedRect(@Nullable LytRect current, int x, int y, |
981 | 982 | return new LytRect(x, y, w, h); |
982 | 983 | } |
983 | 984 |
|
| 985 | + private static void restoreGuiRenderState() { |
| 986 | + // Scene overlays can temporarily change alpha/depth state. Restore the standard GUI state |
| 987 | + // before the document continues rendering blocks below this scene. |
| 988 | + GL11.glMatrixMode(GL11.GL_MODELVIEW); |
| 989 | + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); |
| 990 | + GL11.glEnable(GL11.GL_TEXTURE_2D); |
| 991 | + GL11.glEnable(GL11.GL_BLEND); |
| 992 | + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); |
| 993 | + GL11.glEnable(GL11.GL_ALPHA_TEST); |
| 994 | + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); |
| 995 | + GL11.glDisable(GL11.GL_LIGHTING); |
| 996 | + GL11.glDisable(GL11.GL_DEPTH_TEST); |
| 997 | + GL11.glDepthMask(true); |
| 998 | + GL11.glColor4f(1f, 1f, 1f, 1f); |
| 999 | + RenderHelper.disableStandardItemLighting(); |
| 1000 | + } |
| 1001 | + |
984 | 1002 | private void drawSceneButtons(int drawX, int drawY, int w, int h, int absX, int absY) { |
985 | 1003 | this.lastAbsX = absX; |
986 | 1004 | this.lastAbsY = absY; |
|
0 commit comments