From 785784b694c74839d69a87b489f2883deaf04a6c Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 26 Apr 2018 23:46:32 +0200 Subject: [PATCH] Move HornGlow to the correct package --- .../components => render}/HornGlow.java | 28 +++++++++---------- .../render/HornGlowRenderer.java | 21 +++++++------- 2 files changed, 24 insertions(+), 25 deletions(-) rename src/main/java/com/minelittlepony/{model/components => render}/HornGlow.java (93%) diff --git a/src/main/java/com/minelittlepony/model/components/HornGlow.java b/src/main/java/com/minelittlepony/render/HornGlow.java similarity index 93% rename from src/main/java/com/minelittlepony/model/components/HornGlow.java rename to src/main/java/com/minelittlepony/render/HornGlow.java index 91d028f4..8957540b 100644 --- a/src/main/java/com/minelittlepony/model/components/HornGlow.java +++ b/src/main/java/com/minelittlepony/render/HornGlow.java @@ -1,4 +1,4 @@ -package com.minelittlepony.model.components; +package com.minelittlepony.render; import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.PositionTextureVertex; @@ -7,43 +7,41 @@ import net.minecraft.client.renderer.BufferBuilder; import javax.annotation.Nonnull; -import com.minelittlepony.render.HornGlowRenderer; - public class HornGlow extends ModelBox { private final float alpha; - + private final HornGlowRenderer parent; - + private TexturedQuad[] quadList; public HornGlow(HornGlowRenderer parent, int texU, int texV, float x, float y, float z, int w, int h, int d, float scale, float alpha) { super(parent, texU, texV, x, y, z, w, h, d, scale); - + this.parent = parent; this.alpha = alpha; - + this.quadList = new TexturedQuad[6]; - + float x2 = x + w + scale; float y2 = y + h + scale; float z2 = z + d + scale; - + x -= scale; y -= scale; z -= scale; - + if (parent.mirror) { - float f3 = x2; + float tmp = x2; x2 = x; - x = f3; + x = tmp; } float halfpar4 = x + w * 0.05F; float halfpar6 = z + d * 0.05F; float halfvar11 = x + w * 0.95F; float halfvar13 = z + d * 0.95F; - + PositionTextureVertex p7 = new PositionTextureVertex(halfpar4, y, halfpar6, 0, 0); PositionTextureVertex p0 = new PositionTextureVertex(halfvar11, y, halfpar6, 0, 8); PositionTextureVertex p1 = new PositionTextureVertex(x2, y2, z, 8, 8); @@ -59,7 +57,7 @@ public class HornGlow extends ModelBox { this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{p1, p2, p6, p5}, texU + d + w, texV + d, texU + d + w + w, texV, parent.textureWidth, parent.textureHeight); this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{p0, p7, p2, p1}, texU + d, texV + d, texU + d + w, texV + d + h, parent.textureWidth, parent.textureHeight); this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{p3, p4, p5, p6}, texU + d + w + d, texV + d, texU + d + w + d + w, texV + d + h, parent.textureWidth, parent.textureHeight); - + if (parent.mirror) { for (TexturedQuad i : quadList) { i.flipFace(); @@ -70,7 +68,7 @@ public class HornGlow extends ModelBox { @Override public void render(@Nonnull BufferBuilder buffer, float scale) { parent.applyTint(alpha); - + for (TexturedQuad i : quadList) { i.draw(buffer, scale); } diff --git a/src/main/java/com/minelittlepony/render/HornGlowRenderer.java b/src/main/java/com/minelittlepony/render/HornGlowRenderer.java index 87bf4857..dcc3b0f3 100644 --- a/src/main/java/com/minelittlepony/render/HornGlowRenderer.java +++ b/src/main/java/com/minelittlepony/render/HornGlowRenderer.java @@ -2,39 +2,40 @@ package com.minelittlepony.render; import static net.minecraft.client.renderer.GlStateManager.color; -import com.minelittlepony.model.components.HornGlow; - import net.minecraft.client.model.ModelBase; public class HornGlowRenderer extends BasePonyRenderer { - float r, g, b, a = 1; + float red; + float green; + float blue; + float alpha = 1; public HornGlowRenderer(ModelBase model, int x, int y) { super(model, x, y); } - public HornGlowRenderer setAlpha(float a) { - this.a = a; + public HornGlowRenderer setAlpha(float alpha) { + this.alpha = alpha; return this; } public HornGlowRenderer setTint(int tint) { - r = (tint >> 16 & 255) / 255.0F; - g = (tint >> 8 & 255) / 255.0F; - b = (tint & 255) / 255.0F; + red = (tint >> 16 & 255) / 255.0F; + green = (tint >> 8 & 255) / 255.0F; + blue = (tint & 255) / 255.0F; return this; } public void applyTint(float alpha) { - color(r, g, b, alpha); + color(red, green, blue, alpha); } @Override public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, a)); + cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, alpha)); } @Override