2013-05-30 08:18:07 +00:00
|
|
|
package biomesoplenty.particles;
|
|
|
|
|
|
|
|
import net.minecraft.client.particle.EntityFX;
|
|
|
|
import net.minecraft.client.renderer.Tessellator;
|
2013-07-09 03:55:12 +00:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2013-05-30 08:18:07 +00:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
|
|
|
|
|
|
|
public class EntitySteamFX extends EntityFX
|
2013-05-30 08:18:07 +00:00
|
|
|
{
|
2013-07-03 06:01:28 +00:00
|
|
|
private static final String texture = "biomesoplenty:textures/particles/steam.png";
|
2013-08-30 07:17:24 +00:00
|
|
|
|
|
|
|
float steamParticleScale;
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-30 08:18:07 +00:00
|
|
|
public EntitySteamFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
|
|
|
|
{
|
|
|
|
this(par1World, par2, par4, par6, par8, par10, par12, 1.0F);
|
|
|
|
}
|
|
|
|
|
|
|
|
public EntitySteamFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14)
|
|
|
|
{
|
|
|
|
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
2013-08-30 07:17:24 +00:00
|
|
|
this.motionX *= 0.10000000149011612D;
|
|
|
|
this.motionY *= 0.10000000149011612D;
|
|
|
|
this.motionZ *= 0.10000000149011612D;
|
|
|
|
this.motionX += par8;
|
|
|
|
this.motionY += par10;
|
|
|
|
this.motionZ += par12;
|
|
|
|
this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D);
|
|
|
|
this.particleScale *= 0.75F;
|
|
|
|
this.particleScale *= par14;
|
|
|
|
this.steamParticleScale = this.particleScale;
|
|
|
|
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
|
|
|
this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
|
|
|
|
this.noClip = false;
|
2013-05-30 08:18:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
@Override
|
2013-05-30 10:32:27 +00:00
|
|
|
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
2013-05-30 08:18:07 +00:00
|
|
|
{
|
2013-08-30 07:17:24 +00:00
|
|
|
float f = (particleAge + par2) / particleMaxAge * 32.0F;
|
2013-05-30 08:18:07 +00:00
|
|
|
|
2013-08-30 07:17:24 +00:00
|
|
|
if (f < 0.0F)
|
2013-05-30 08:18:07 +00:00
|
|
|
{
|
2013-08-30 07:17:24 +00:00
|
|
|
f = 0.0F;
|
2013-05-30 08:18:07 +00:00
|
|
|
}
|
|
|
|
|
2013-08-30 07:17:24 +00:00
|
|
|
if (f > 1.0F)
|
2013-05-30 08:18:07 +00:00
|
|
|
{
|
2013-08-30 07:17:24 +00:00
|
|
|
f = 1.0F;
|
2013-05-30 08:18:07 +00:00
|
|
|
}
|
|
|
|
|
2013-08-30 07:17:24 +00:00
|
|
|
particleScale = particleScale * f;
|
2013-05-30 08:18:07 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
tessellator.draw();
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
|
|
|
|
GL11.glDepthMask(false);
|
|
|
|
GL11.glEnable(3042);
|
|
|
|
GL11.glBlendFunc(770, 1);
|
|
|
|
|
2013-09-13 08:17:21 +00:00
|
|
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
|
2013-08-30 07:17:24 +00:00
|
|
|
|
|
|
|
float f6 = (float)this.particleTextureIndexX / 16.0F;
|
|
|
|
float f7 = f6 + 0.0624375F;
|
|
|
|
float f8 = (float)this.particleTextureIndexY / 16.0F;
|
|
|
|
float f9 = f8 + 0.0624375F;
|
|
|
|
float f10 = 0.1F * this.particleScale;
|
|
|
|
|
|
|
|
if (this.particleIcon != null)
|
|
|
|
{
|
|
|
|
f6 = this.particleIcon.getMinU();
|
|
|
|
f7 = this.particleIcon.getMaxU();
|
|
|
|
f8 = this.particleIcon.getMinV();
|
|
|
|
f9 = this.particleIcon.getMaxV();
|
|
|
|
}
|
|
|
|
|
|
|
|
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
|
|
|
|
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
|
|
|
|
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
|
|
|
|
float f14 = 1.0F;
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
tessellator.startDrawingQuads();
|
|
|
|
tessellator.setBrightness(10);
|
2013-08-30 07:17:24 +00:00
|
|
|
|
|
|
|
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
|
|
|
|
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
|
|
|
|
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
|
|
|
|
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
|
|
|
|
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
tessellator.draw();
|
|
|
|
|
|
|
|
GL11.glDisable(3042);
|
|
|
|
GL11.glDepthMask(true);
|
|
|
|
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
|
2013-09-13 08:17:21 +00:00
|
|
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
|
2013-05-31 10:34:02 +00:00
|
|
|
tessellator.startDrawingQuads();
|
2013-05-30 08:18:07 +00:00
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to update the entity's position/logic.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void onUpdate()
|
|
|
|
{
|
|
|
|
prevPosX = posX;
|
|
|
|
prevPosY = posY;
|
|
|
|
prevPosZ = posZ;
|
|
|
|
|
|
|
|
if (particleAge++ >= particleMaxAge)
|
|
|
|
{
|
|
|
|
this.setDead();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setParticleTextureIndex(7 - particleAge * 8 / particleMaxAge);
|
|
|
|
motionY += 0.004D;
|
|
|
|
this.moveEntity(motionX, motionY, motionZ);
|
|
|
|
|
|
|
|
if (posY == prevPosY)
|
|
|
|
{
|
|
|
|
motionX *= 1.1D;
|
|
|
|
motionZ *= 1.1D;
|
|
|
|
}
|
|
|
|
|
|
|
|
motionX *= 0.9599999785423279D;
|
|
|
|
motionY *= 0.9599999785423279D;
|
|
|
|
motionZ *= 0.9599999785423279D;
|
|
|
|
|
|
|
|
if (onGround)
|
|
|
|
{
|
|
|
|
motionX *= 0.699999988079071D;
|
|
|
|
motionZ *= 0.699999988079071D;
|
|
|
|
}
|
|
|
|
}
|
2013-05-30 08:18:07 +00:00
|
|
|
}
|