yea, its propably better to post the codes. right now everything works except the FlashFX. it doesn't show somehow. I spawn these particles with above an TileEntity. so it shouldn't have any motion nor offset.
EffectWelling, this is the Entity I spawn in with "EffectRenderer.addEffect()". this will spawn in the other 3.
package mechanical_crafting_table.client.particles;
import mechanical_crafting_table.client.particles.entityfx.EntityWellFlashFX;
import mechanical_crafting_table.client.particles.entityfx.EntityWellGlowFX;
import mechanical_crafting_table.client.particles.entityfx.EntityWellSparkFX;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EffectWelling extends EntityFX
{
private boolean canSpawn = true;
private int WellAge;
private int count;
public EffectWelling(World world, double x, double y, double z, double mX,double mY, double mZ)
{
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
this.motionX = mX;
this.motionY = mY;
this.motionZ = mZ;
this.particleMaxAge = 1;
}
public void renderParticle(Tessellator tess, float x, float y, float z, float mX, float mY, float mZ) {}
public void onUpdate()
{
if(this.particleAge < this.particleMaxAge && count == 0)
{
this.createBurst();
count++;
}
++this.WellAge;
if (this.WellAge > this.particleMaxAge)
{
this.setDead();
count = 0;
}
}
private void createBurst()
{
double d0 = this.rand.nextGaussian() * 0.05D;
double d1 = this.rand.nextGaussian() * 0.05D;
this.createParticle(this.posX + 0.095D, this.posY - 0.095D, this.posZ, 0.0D, 0.0D, 0.0D, 3);
for (int i = 0; i < 2; ++i)
{
double d2 = this.rand.nextGaussian() * 0.15D + d0;
double d3 = this.rand.nextGaussian() * 0.15D + d1;
double d4 = this.rand.nextDouble() * 0.5D;
this.createParticle(this.posX, this.posY, this.posZ, d2, d4, d3, 1);
}
this.createParticle(this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, 2);
}
private void createParticle(double x, double y, double z, double mX, double mY, double mZ, int id)
{
switch(id){
case 1:
EntityWellSparkFX WellingSpark = new EntityWellSparkFX(this.worldObj, x, y, z, mX, mY, mZ);
Minecraft.getMinecraft().effectRenderer.addEffect(WellingSpark);
break;
case 2:
EntityWellGlowFX WellingGlow = new EntityWellGlowFX(this.worldObj, x, y, z);
WellingGlow.setRBGColorF((float)244/255, (float)255/255, (float)130/255);
WellingGlow.setFadeColour((float)160/255, (float)33/255, (float)46/255);
Minecraft.getMinecraft().effectRenderer.addEffect(WellingGlow);
break;
case 3:
EntityWellFlashFX WellingFlash = new EntityWellFlashFX(this.worldObj, x, y, z);
Minecraft.getMinecraft().effectRenderer.addEffect(WellingFlash);
break;
}
}
}
EntityWellingSparkFX.
package mechanical_crafting_table.client.particles.entityfx;
import static org.lwjgl.opengl.GL11.*;
import mechanical_crafting_table.Main;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityWellSparkFX extends EntityFX
{
private static final ResourceLocation WellingFXTexture = new ResourceLocation(Main.MODID, "textures/particles/WellingSpark.png");
public EntityWellSparkFX(World world, double x, double y, double z, double mX, double mY, double mZ)
{
super(world, x, y, z, mX, mY, mZ);
this.motionX = mX;
this.motionY = mY;
this.motionZ = mZ;
this.particleScale *= 0.4F;
this.particleAlpha = 1.0F;
this.particleMaxAge = 5 + this.rand.nextInt(5);
this.particleGravity = 1F;
this.noClip = false;
}
public void renderParticle(Tessellator tess, float particleTicks, float x, float y, float z, float u, float v)
{
if(this.particleAge < this.particleMaxAge)
{
Minecraft.getMinecraft().renderEngine.bindTexture(WellingFXTexture);
glDepthMask(false);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER, 0.003921569F);
tess.startDrawingQuads();
tess.setBrightness(getBrightnessForRender(particleTicks));
glAlphaFunc(GL_GREATER, 0.6F - ((float)this.particleAge + particleTicks - 1.0F) * 0.25F * 0.5F);
float f10 = 0.1F * this.particleScale;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)particleTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)particleTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)particleTicks - interpPosZ);
tess.addVertexWithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0);//WithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0);// (double)f7, (double)f9);
tess.addVertexWithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 0, 1);//WithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 1, 0);// (double)f7, (double)f8);
tess.addVertexWithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1);//WithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1);// (double)f6, (double)f8);
tess.addVertexWithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 1, 0);//WithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 0, 1);// (double)f6, (double)f9);
tess.draw();
glDisable(GL_BLEND);
glDepthMask(true);
glAlphaFunc(GL_GREATER, 0.1F);
}
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float) this.particleAge - (float) (this.particleMaxAge / 2)) / (float) this.particleMaxAge);
}
this.motionY -= 0.004D * (double)this.particleGravity;;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.2D;//0.9100000262260437D;
this.motionY *= 0.05D;//0.9100000262260437D;
this.motionZ *= 0.2D;//0.9100000262260437D;
this.setRBGColorF(this.particleRed, this.particleBlue, this.particleGreen);
if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
if (this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
EntityWellSparkFX EntityWell = new EntityWellSparkFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
EntityWell.particleAge = EntityWell.particleMaxAge / 2;
Minecraft.getMinecraft().effectRenderer.addEffect(EntityWell);
}
}
public int getBrightnessForRender(float brightnessFR)
{
return 15728880;
}
public float getBrightness(float brightness)
{
return 1.0F;
}
public boolean canBePushed()
{
return true;
}
public int getFXLayer()
{
return 3;
}
}
EntityWellingGlowFX.
package mechanical_crafting_table.client.particles.entityfx;
import static org.lwjgl.opengl.GL11.*;
import mechanical_crafting_table.Main;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityWellGlowFX extends EntityFX
{
private static final ResourceLocation GlowingFXTexture = new ResourceLocation(Main.MODID, "textures/particles/WellingGlow.png");
private float fadeColourR;
private float fadeColourG;
private float fadeColourB;
private boolean hasFade;
public EntityWellGlowFX(World world, double x, double y, double z)
{
super(world, x, y, z, 0, 0, 0);
this.particleScale *= 0.75F;
this.particleMaxAge = 72;// + this.rand.nextInt(12);
this.noClip = false;
this.particleGravity = 0F;
this.particleAlpha = 1.0F;
this.motionX = this.motionX * 0.00;
this.motionY = this.motionY * 0.00;
this.motionZ = this.motionZ * 0.00;
}
public void renderParticle(Tessellator tess, float particleTicks, float x, float y, float z, float u, float v)
{
if (this.particleAge < this.particleMaxAge)
{
Minecraft.getMinecraft().renderEngine.bindTexture(GlowingFXTexture);
glDepthMask(false);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
tess.startDrawingQuads();
tess.setBrightness(getBrightnessForRender(particleTicks));
float f10 = 0.1F * this.particleScale;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)particleTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)particleTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)particleTicks - interpPosZ);
float CR = this.particleRed;
float CG = this.particleGreen;
float CB = this.particleBlue;
tess.setColorRGBA_F(CR, CG, CB, this.particleAlpha);
tess.addVertexWithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0);//WithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0);// (double)f7, (double)f9);
tess.addVertexWithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 0, 1);//WithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 1, 0);// (double)f7, (double)f8);
tess.addVertexWithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1);//WithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1);// (double)f6, (double)f8);
tess.addVertexWithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 1, 0);//WithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 0, 1);// (double)f6, (double)f9);
tess.draw();
glDisable(GL_BLEND);
glDepthMask(true);
glAlphaFunc(GL_GREATER, 0.1F);
}
}
public void setFadeColour(float CR, float CG, float CB)
{
this.fadeColourR = CR;
this.fadeColourG = CG;
this.fadeColourB = CB;
this.hasFade = true;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ > this.particleMaxAge)
{
this.setDead();
}
if(this.particleAge > (this.particleMaxAge / 4)*3)
{
this.setAlphaF(this.particleAlpha / 2);
}
else
{
this.setAlphaF(1.0F);
}
if (this.hasFade && this.particleAge > this.particleMaxAge / 2)
{
this.particleRed -= ((this.particleRed - this.fadeColourR) / this.particleMaxAge) * this.particleAge;
this.particleGreen -= ((this.particleGreen - this.fadeColourG) / this.particleMaxAge) * this.particleAge;
this.particleBlue -= ((this.particleBlue - this.fadeColourB) / this.particleMaxAge) * this.particleAge;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.0;
this.motionY *= 0.0;
this.motionZ *= 0.0;
}
public int getBrightnessForRender(float brightnessFR)
{
return 15728880;
}
public float getBrightness(float brightness)
{
return 0.654F;
}
public int getFXLayer()
{
return 3;
}
}
EntityWellingFlashFX. Right now this is not visible, eventhough it gets spawned in.(I debugged it)
package mechanical_crafting_table.client.particles.entityfx;
import static org.lwjgl.opengl.GL11.*;
import mechanical_crafting_table.Main;
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;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityWellFlashFX extends EntityFX
{
private static final ResourceLocation WellingFXTexture = new ResourceLocation(Main.MODID, "textures/particles/WellingFlash.png");
public EntityWellFlashFX(World world, double x, double y, double z)
{
super(world, x, y, z);
this.particleScale = 8.0F;
this.particleMaxAge = 2;
this.particleGravity = 1F;
this.particleAlpha = 0.4F;
this.noClip = false;
}
@Override
public void renderParticle(Tessellator tess, float particleTicks, float x, float y, float z, float u, float v)
{
if(this.particleAge < this.particleMaxAge)
{
Minecraft.getMinecraft().renderEngine.bindTexture(WellingFXTexture);
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
glDepthMask(false);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER, 0.003921569F);
tess.startDrawingQuads();
tess.setBrightness(this.getBrightnessForRender(particleTicks));
float f10 = 0.1F * this.particleScale;
float f11 = (float) this.posX;
float f12 = (float) this.posY;
float f13 = (float) this.posZ;
tess.addVertexWithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0);
tess.addVertexWithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 0, 1);
tess.addVertexWithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1);
tess.addVertexWithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 1, 0);
tess.draw();
glDisable(GL_BLEND);
glDepthMask(true);
glAlphaFunc(GL_GREATER, 1.0F);
}
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
if (this.particleAge > this.particleMaxAge / 5)
{
this.setAlphaF(this.particleAlpha / 2);
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.0D;
this.motionY *= 0.0D;
this.motionZ *= 0.0D;
}
public int getBrightnessForRender(float brightnessFR)
{
return 15728880;
}
public float getBrightness(float brightness)
{
return 1.0F;
}
public int getFXLayer()
{
return 3;
}
}
About point 4, I tried to set the boundingbox earlier, but doesnt seem to work somehow. Anyway, I looked at the XPOrb, cause they get picked up when they collide with the player. And it seems that MC. is using an actual Entity. so I might have to create one for this purpose.(but it will get pretty laggy if I spawn a bunch of them in. (wich Im planning on doing)