Fix 3rd person translucency bug (#237)

This commit is contained in:
SuperSoupr authored and GitHub committed 2025-12-15 00:39:25 +01:00
1 parent 42c27d7cd9
commit e078228eb8
1 file changed
+10
@@ -1,5 +1,6 @@
package tconstruct.client;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -9,6 +10,7 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL14;
import tconstruct.TConstruct;
import tconstruct.library.tools.ToolCore;
@@ -97,6 +99,12 @@ public class FlexibleToolRenderer implements IItemRenderer {
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
int srcRGB = GL11.glGetInteger(GL14.GL_BLEND_SRC_RGB);
int dstRGB = GL11.glGetInteger(GL14.GL_BLEND_DST_RGB);
int srcAlpha = GL11.glGetInteger(GL14.GL_BLEND_SRC_ALPHA);
int dstAlpha = GL11.glGetInteger(GL14.GL_BLEND_DST_ALPHA);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
if (type != ItemRenderType.ENTITY) {
specialAnimation(type, item);
} else GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft.
@@ -205,6 +213,8 @@ public class FlexibleToolRenderer implements IItemRenderer {
}
tess.draw();
OpenGlHelper.glBlendFunc(srcRGB, dstRGB, srcAlpha, dstAlpha);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();