From c19527d95e5095fe9bc76a44aab7c26c766a95d3 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 6 Jul 2019 15:43:19 +0200 Subject: [PATCH] Backport: Fixed horn glows not using the right colour --- .../minelittlepony/model/components/UnicornHorn.java | 5 +++-- .../minelittlepony/render/model/GlowRenderer.java | 12 +++--------- .../com/minelittlepony/render/model/ModelGlow.java | 8 +------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/components/UnicornHorn.java b/src/main/java/com/minelittlepony/model/components/UnicornHorn.java index 6cd3d6f6..f7ba1b1d 100644 --- a/src/main/java/com/minelittlepony/model/components/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/model/components/UnicornHorn.java @@ -34,9 +34,10 @@ public class UnicornHorn implements IModelPart { .rotateAngleX = 0.5F; glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z) + .setAlpha(0.4F) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) - .setAlpha(0.4f).box(0, 0, 0, 1, 4, 1, stretch + 0.5F) - .setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F); + .box(0, 0, 0, 1, 4, 1, stretch + 0.5F) + .box(0, 0, 0, 1, 3, 1, stretch + 0.8F); } @Override diff --git a/src/main/java/com/minelittlepony/render/model/GlowRenderer.java b/src/main/java/com/minelittlepony/render/model/GlowRenderer.java index 0e9becb5..dc600392 100644 --- a/src/main/java/com/minelittlepony/render/model/GlowRenderer.java +++ b/src/main/java/com/minelittlepony/render/model/GlowRenderer.java @@ -3,8 +3,6 @@ package com.minelittlepony.render.model; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; -import org.lwjgl.opengl.GL11; - import com.minelittlepony.util.render.AbstractBoxRenderer; import com.minelittlepony.util.render.Color; @@ -29,21 +27,17 @@ public class GlowRenderer extends AbstractBoxRenderer { return this; } - public void applyTint(float alpha) { - Color.glColor(tint, alpha); - } - @Override public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - cubeList.add(new ModelGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, alpha)); + cubeList.add(new ModelGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor)); } @Override public void render(float scale) { - GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); Minecraft.getMinecraft().entityRenderer.disableLightmap(); + Color.glColor(tint, alpha); super.render(scale); - GL11.glPopAttrib(); + Minecraft.getMinecraft().entityRenderer.enableLightmap(); } @Override diff --git a/src/main/java/com/minelittlepony/render/model/ModelGlow.java b/src/main/java/com/minelittlepony/render/model/ModelGlow.java index 54289295..a5ac323a 100644 --- a/src/main/java/com/minelittlepony/render/model/ModelGlow.java +++ b/src/main/java/com/minelittlepony/render/model/ModelGlow.java @@ -11,15 +11,11 @@ import com.minelittlepony.util.render.Vertex; */ public class ModelGlow extends Box { - private final float alpha; - private Quad[] quadList; - public ModelGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, float alpha) { + public ModelGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale) { super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale); - this.alpha = alpha; - float xMax = xMin + w + scale; float yMax = yMin + h + scale; float zMax = zMin + d + scale; @@ -69,8 +65,6 @@ public class ModelGlow extends Box { @Override public void render(BufferBuilder buffer, float scale) { - parent.applyTint(alpha); - for (Quad i : quadList) { i.draw(buffer, scale); }