worked on naming vars in FXBeam
A lot of the vars are not named in this class and make it hard to work on.
This commit is contained in:
parent
acc0bec88d
commit
1c57103d53
1 changed files with 59 additions and 36 deletions
|
@ -26,17 +26,27 @@ public class FXBeam extends EntityFX
|
|||
double movZ = 0.0D;
|
||||
|
||||
private float length = 0.0F;
|
||||
|
||||
private float rotYaw = 0.0F;
|
||||
private float rotPitch = 0.0F;
|
||||
private int rotSpeed = 20;
|
||||
|
||||
private float prevYaw = 0.0F;
|
||||
private float prevPitch = 0.0F;
|
||||
private Vector3 target = new Vector3();
|
||||
|
||||
private Vector3 endLocation = new Vector3();
|
||||
|
||||
private float endModifier = 1.0F;
|
||||
|
||||
/** Reverse rotation */
|
||||
private boolean reverse = false;
|
||||
/** pulse or fade as the life span goes down */
|
||||
private boolean pulse = false;
|
||||
private int rotationSpeed = 20;
|
||||
|
||||
private float prevSize = 0.0F;
|
||||
/** beam diameter */
|
||||
private float beamD = 0.08f;
|
||||
|
||||
private String texture = DarkMain.TEXTURE_DIRECTORY + "";
|
||||
|
||||
public FXBeam(World world, Vector3 start, Vector3 end, Color color, String texture, int age, boolean pulse)
|
||||
|
@ -49,20 +59,22 @@ public class FXBeam extends EntityFX
|
|||
{
|
||||
super(world, start.x, start.y, start.z, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
this.setRGB(color.getRed(), color.getGreen(), color.getBlue());
|
||||
this.setRGB(color);
|
||||
|
||||
this.texture = texture;
|
||||
|
||||
this.setSize(0.02F, 0.02F);
|
||||
this.noClip = true;
|
||||
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.target = end;
|
||||
float xd = (float) (this.posX - this.target.x);
|
||||
float yd = (float) (this.posY - this.target.y);
|
||||
float zd = (float) (this.posZ - this.target.z);
|
||||
this.length = (float) new Vector3(this).distanceTo(this.target);
|
||||
|
||||
this.endLocation = end;
|
||||
float xd = (float) (this.posX - this.endLocation.x);
|
||||
float yd = (float) (this.posY - this.endLocation.y);
|
||||
float zd = (float) (this.posZ - this.endLocation.z);
|
||||
this.length = (float) new Vector3(this).distanceTo(this.endLocation);
|
||||
double var7 = MathHelper.sqrt_double(xd * xd + zd * zd);
|
||||
this.rotYaw = ((float) (Math.atan2(xd, zd) * 180.0D / 3.141592653589793D));
|
||||
this.rotPitch = ((float) (Math.atan2(yd, var7) * 180.0D / 3.141592653589793D));
|
||||
|
@ -95,16 +107,16 @@ public class FXBeam extends EntityFX
|
|||
this.prevYaw = this.rotYaw;
|
||||
this.prevPitch = this.rotPitch;
|
||||
|
||||
float xd = (float) (this.posX - this.target.x);
|
||||
float yd = (float) (this.posY - this.target.y);
|
||||
float zd = (float) (this.posZ - this.target.z);
|
||||
float deltaX = (float) (this.posX - this.endLocation.x);
|
||||
float deltaY = (float) (this.posY - this.endLocation.y);
|
||||
float deltaZ = (float) (this.posZ - this.endLocation.z);
|
||||
|
||||
this.length = MathHelper.sqrt_float(xd * xd + yd * yd + zd * zd);
|
||||
this.length = MathHelper.sqrt_float(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
|
||||
|
||||
double var7 = MathHelper.sqrt_double(xd * xd + zd * zd);
|
||||
double xzMag = MathHelper.sqrt_double(deltaX * deltaX + deltaZ * deltaZ);
|
||||
|
||||
this.rotYaw = ((float) (Math.atan2(xd, zd) * 180.0D / 3.141592653589793D));
|
||||
this.rotPitch = ((float) (Math.atan2(yd, var7) * 180.0D / 3.141592653589793D));
|
||||
this.rotYaw = ((float) (Math.atan2(deltaX, deltaZ) * 180.0D / 3.141592653589793D));
|
||||
this.rotPitch = ((float) (Math.atan2(deltaY, xzMag) * 180.0D / 3.141592653589793D));
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
|
@ -119,6 +131,13 @@ public class FXBeam extends EntityFX
|
|||
this.particleBlue = b;
|
||||
}
|
||||
|
||||
public void setRGB(Color color)
|
||||
{
|
||||
this.particleRed = color.getRed();
|
||||
this.particleGreen = color.getGreen();
|
||||
this.particleBlue = color.getBlue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
|
@ -127,19 +146,20 @@ public class FXBeam extends EntityFX
|
|||
GL11.glPushMatrix();
|
||||
float var9 = 1.0F;
|
||||
float slide = this.worldObj.getTotalWorldTime();
|
||||
float rot = this.worldObj.provider.getWorldTime() % (360 / this.rotationSpeed) * this.rotationSpeed + this.rotationSpeed * f;
|
||||
float rot = this.worldObj.provider.getWorldTime() % (360 / this.rotSpeed) * this.rotSpeed + this.rotSpeed * f;
|
||||
|
||||
float size = 1.0F;
|
||||
float alphaColor = 0.5F;
|
||||
|
||||
if (this.pulse)
|
||||
{
|
||||
size = Math.min(this.particleAge / 4.0F, 1.0F);
|
||||
size = this.prevSize + (size - this.prevSize) * f;
|
||||
}
|
||||
if ((this.particleMaxAge - this.particleAge <= 4))
|
||||
{
|
||||
alphaColor = 0.5F - (4 - (this.particleMaxAge - this.particleAge)) * 0.1F;
|
||||
}
|
||||
|
||||
float op = 0.5F;
|
||||
if ((this.pulse) && (this.particleMaxAge - this.particleAge <= 4))
|
||||
{
|
||||
op = 0.5F - (4 - (this.particleMaxAge - this.particleAge)) * 0.1F;
|
||||
}
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(this.texture));
|
||||
|
@ -151,7 +171,9 @@ public class FXBeam extends EntityFX
|
|||
|
||||
float var11 = slide + f;
|
||||
if (this.reverse)
|
||||
{
|
||||
var11 *= -1.0F;
|
||||
}
|
||||
float var12 = -var11 * 0.2F - MathHelper.floor_float(-var11 * 0.1F);
|
||||
|
||||
GL11.glEnable(3042);
|
||||
|
@ -163,34 +185,35 @@ public class FXBeam extends EntityFX
|
|||
float zz = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * f - interpPosZ);
|
||||
GL11.glTranslated(xx, yy, zz);
|
||||
|
||||
float ry = this.prevYaw + (this.rotYaw - this.prevYaw) * f;
|
||||
float rp = this.prevPitch + (this.rotPitch - this.prevPitch) * f;
|
||||
float yaw = this.prevYaw + (this.rotYaw - this.prevYaw) * f;
|
||||
float pitch = this.prevPitch + (this.rotPitch - this.prevPitch) * f;
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F + ry, 0.0F, 0.0F, -1.0F);
|
||||
GL11.glRotatef(rp, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F + yaw, 0.0F, 0.0F, -1.0F);
|
||||
GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
double var44 = -beamD * size;
|
||||
double var17 = beamD * size;
|
||||
double var44b = -beamD * size * this.endModifier;
|
||||
double var17b = beamD * size * this.endModifier;
|
||||
double negWidth = -beamD * size;
|
||||
double posWidth = beamD * size;
|
||||
//TODO test length without size to see if that will fix length render changes
|
||||
double negLength = -beamD * size * this.endModifier;
|
||||
double posLength = beamD * size * this.endModifier;
|
||||
|
||||
GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
|
||||
for (int t = 0; t < 3; t++)
|
||||
{
|
||||
double var29 = this.length * size * var9;
|
||||
double dist = this.length * size * var9;
|
||||
double var31 = 0.0D;
|
||||
double var33 = 1.0D;
|
||||
double var35 = -1.0F + var12 + t / 3.0F;
|
||||
double var37 = this.length * size * var9 + var35;
|
||||
double uvLength = this.length * size * var9 + var35;
|
||||
|
||||
GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(200);
|
||||
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, op);
|
||||
tessellator.addVertexWithUV(var44b, var29, 0.0D, var33, var37);
|
||||
tessellator.addVertexWithUV(var44, 0.0D, 0.0D, var33, var35);
|
||||
tessellator.addVertexWithUV(var17, 0.0D, 0.0D, var31, var35);
|
||||
tessellator.addVertexWithUV(var17b, var29, 0.0D, var31, var37);
|
||||
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, alphaColor);
|
||||
tessellator.addVertexWithUV(negLength, dist, 0.0D, var33, uvLength);
|
||||
tessellator.addVertexWithUV(negWidth, 0.0D, 0.0D, var33, var35);
|
||||
tessellator.addVertexWithUV(posWidth, 0.0D, 0.0D, var31, var35);
|
||||
tessellator.addVertexWithUV(posLength, dist, 0.0D, var31, uvLength);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue