package com.yolp900.itsjustacharm.client.particles;
import com.yolp900.itsjustacharm.ItsJustaCharm;
import com.yolp900.itsjustacharm.reference.LibParticles;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public abstract class ModParticle extends Particle {
private LibParticles particle;
public ModParticle(LibParticles particle, World world, double x, double y, double z, double size, double red, double green, double blue) {
super(world, x, y, z);
this.particle = particle;
ResourceLocation texture = getParticleTexture();
TextureAtlasSprite sprite = ItsJustaCharm.proxy.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString());
this.setParticleTexture(sprite);
this.particleScale *= size;
setColor(red, green, blue);
}
public void setColor(double red, double green, double blue) {
this.particleRed = (float)red;
this.particleGreen = (float)green;
this.particleBlue = (float)blue;
}
public void setMotion(double motionX, double motionY, double motionZ) {
this.motionX = motionX;
this.motionY = motionY;
this.motionZ = motionZ;
}
@Override
public int getFXLayer() {
return 1;
}
@Override
public void onUpdate() {
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge || this.isCollided)
setExpired();
posX += motionX;
posY += motionY;
posZ += motionZ;
}
public ResourceLocation getParticleTexture() {
return particle.getTexture();
}
}