Move HornGlow to the correct package

This commit is contained in:
Sollace 2018-04-26 23:46:32 +02:00
parent 441fc61508
commit 785784b694
2 changed files with 24 additions and 25 deletions

View file

@ -1,4 +1,4 @@
package com.minelittlepony.model.components; package com.minelittlepony.render;
import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.PositionTextureVertex; import net.minecraft.client.model.PositionTextureVertex;
@ -7,43 +7,41 @@ import net.minecraft.client.renderer.BufferBuilder;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.minelittlepony.render.HornGlowRenderer;
public class HornGlow extends ModelBox { public class HornGlow extends ModelBox {
private final float alpha; private final float alpha;
private final HornGlowRenderer parent; private final HornGlowRenderer parent;
private TexturedQuad[] quadList; 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) { 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); super(parent, texU, texV, x, y, z, w, h, d, scale);
this.parent = parent; this.parent = parent;
this.alpha = alpha; this.alpha = alpha;
this.quadList = new TexturedQuad[6]; this.quadList = new TexturedQuad[6];
float x2 = x + w + scale; float x2 = x + w + scale;
float y2 = y + h + scale; float y2 = y + h + scale;
float z2 = z + d + scale; float z2 = z + d + scale;
x -= scale; x -= scale;
y -= scale; y -= scale;
z -= scale; z -= scale;
if (parent.mirror) { if (parent.mirror) {
float f3 = x2; float tmp = x2;
x2 = x; x2 = x;
x = f3; x = tmp;
} }
float halfpar4 = x + w * 0.05F; float halfpar4 = x + w * 0.05F;
float halfpar6 = z + d * 0.05F; float halfpar6 = z + d * 0.05F;
float halfvar11 = x + w * 0.95F; float halfvar11 = x + w * 0.95F;
float halfvar13 = z + d * 0.95F; float halfvar13 = z + d * 0.95F;
PositionTextureVertex p7 = new PositionTextureVertex(halfpar4, y, halfpar6, 0, 0); PositionTextureVertex p7 = new PositionTextureVertex(halfpar4, y, halfpar6, 0, 0);
PositionTextureVertex p0 = new PositionTextureVertex(halfvar11, y, halfpar6, 0, 8); PositionTextureVertex p0 = new PositionTextureVertex(halfvar11, y, halfpar6, 0, 8);
PositionTextureVertex p1 = new PositionTextureVertex(x2, y2, z, 8, 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[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[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); 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) { if (parent.mirror) {
for (TexturedQuad i : quadList) { for (TexturedQuad i : quadList) {
i.flipFace(); i.flipFace();
@ -70,7 +68,7 @@ public class HornGlow extends ModelBox {
@Override @Override
public void render(@Nonnull BufferBuilder buffer, float scale) { public void render(@Nonnull BufferBuilder buffer, float scale) {
parent.applyTint(alpha); parent.applyTint(alpha);
for (TexturedQuad i : quadList) { for (TexturedQuad i : quadList) {
i.draw(buffer, scale); i.draw(buffer, scale);
} }

View file

@ -2,39 +2,40 @@ package com.minelittlepony.render;
import static net.minecraft.client.renderer.GlStateManager.color; import static net.minecraft.client.renderer.GlStateManager.color;
import com.minelittlepony.model.components.HornGlow;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
public class HornGlowRenderer extends BasePonyRenderer<HornGlowRenderer> { public class HornGlowRenderer extends BasePonyRenderer<HornGlowRenderer> {
float r, g, b, a = 1; float red;
float green;
float blue;
float alpha = 1;
public HornGlowRenderer(ModelBase model, int x, int y) { public HornGlowRenderer(ModelBase model, int x, int y) {
super(model, x, y); super(model, x, y);
} }
public HornGlowRenderer setAlpha(float a) { public HornGlowRenderer setAlpha(float alpha) {
this.a = a; this.alpha = alpha;
return this; return this;
} }
public HornGlowRenderer setTint(int tint) { public HornGlowRenderer setTint(int tint) {
r = (tint >> 16 & 255) / 255.0F; red = (tint >> 16 & 255) / 255.0F;
g = (tint >> 8 & 255) / 255.0F; green = (tint >> 8 & 255) / 255.0F;
b = (tint & 255) / 255.0F; blue = (tint & 255) / 255.0F;
return this; return this;
} }
public void applyTint(float alpha) { public void applyTint(float alpha) {
color(r, g, b, alpha); color(red, green, blue, alpha);
} }
@Override @Override
public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { 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 @Override