mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 14:27:59 +01:00
Move HornGlow to the correct package
This commit is contained in:
parent
441fc61508
commit
785784b694
2 changed files with 24 additions and 25 deletions
|
@ -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);
|
||||
}
|
|
@ -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<HornGlowRenderer> {
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue