package izzyaxel.arcaneartificing.entity.effects;

import izzyaxel.arcaneartificing.main.AAReference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

public class PylonBlueFX extends EntityFX
{
	double gravity, friction, r_e, g_e, b_e, opacity_e;
	private static final ResourceLocation texture = new ResourceLocation(AAReference.MODID, "textures/particles/pylon.png");

	public PylonBlueFX(World world, double x, double y, double z, double motionx, double motiony, double motionz, float size, int maxTimeMul)
	{
		super(world, x, y, z, motionx, motiony, motionz);
		this.motionX = motionx;
		this.motionY = motiony;
		this.motionZ = motionz;
		this.particleScale = size/10;
		this.particleMaxAge = maxTimeMul;
		this.r_e = 0;
		this.g_e = 0;
		this.b_e = 1;
		this.opacity_e = 1.0;
		this.noClip = true;
	}

	@Override
	public void renderParticle(Tessellator tess, float par2, float par3, float par4, float par5, float par6, float par7)
	{
		AAParticleRenderer.doRenderParticle(tess, par2, par3, par4, par5, par6, par7, this.posX, this.posY, this.posZ, this.prevPosX, this.prevPosY, this.prevPosZ, interpPosX, interpPosY, interpPosZ, this.particleScale, texture, this.r_e, this.g_e, this.b_e, this.opacity_e, false, true);
	}

	@Override
	public int getFXLayer()
	{
		return 3;
	}

	@Override
	public void onUpdate()
	{
		if(particleAge > particleMaxAge)
			this.setDead();
		if(Minecraft.getMinecraft().gameSettings.particleSetting == 2)
			this.setDead();
		this.motionHandler();
		this.particleScale -= 0.19f;
		this.opacity_e -= 0.03f;
		this.particleAge++;
	}

	public void motionHandler()
	{
		this.prevPosX = this.posX;
		this.prevPosY = this.posY;
		this.prevPosZ = this.posZ;
		this.moveEntity(this.motionX, this.motionY, this.motionZ);
	}
}
