Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/main/java/cam72cam/mod/render/opengl/VBO.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormatElement;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.InventoryMenu;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL32;

Expand Down Expand Up @@ -175,6 +177,8 @@ protected Binding(RenderState state, boolean wait) {
} else {
GL32.glDisableClientState(GL32.GL_NORMAL_ARRAY);
}*/

RenderType renderType;
ShaderInstance shader;
if (state.stage != null) {
shader = switch (state.stage) {
Expand All @@ -185,10 +189,22 @@ protected Binding(RenderState state, boolean wait) {
? GameRenderer.getRendertypeEntityCutoutShader()
: RenderContext.UMC_CORE;
};

renderType = switch (state.stage) {
case GUI -> null;
default -> RenderType.entityCutout(InventoryMenu.BLOCK_ATLAS);
Copy link
Member

@Goldenfield192 Goldenfield192 Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change the ones in EntityRenderer and BlockRender from cutout/cutoutMipped to entityCutout to solve the problem? I think it would be more straightforward

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah just ignore this

};
} else {
shader = GameRenderer.getRendertypeEntityCutoutShader();
renderType = RenderType.entityCutout(InventoryMenu.BLOCK_ATLAS);
}

if (renderType != null) {
renderType.setupRenderState();
}

RenderSystem.setShader(() -> shader);

GL32.glBindVertexArray(vao);
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, vbo);

Expand Down Expand Up @@ -247,6 +263,11 @@ protected Binding(RenderState state, boolean wait) {

this.restore = RenderContext.apply(state, true).and(() -> {
RenderContext.checkError();

if (renderType != null) {
renderType.clearRenderState();
}

shader.getVertexFormat().clearBufferState();

RenderContext.checkError();
Expand Down