Jump to content

Recommended Posts

Posted

So sometimes, the particles that are given off by my projectiles are just left in the air (just parts of it) and just seem to float there indefinitely.

 

 

My particle spawn code:

 

 

@Override

public void onUpdate()

  {

      super.onUpdate();

        if (!this.worldObj.isRemote) {

      for (int var3 = 0; var3 < 8; ++var3)

        {

            Sprinkles var1 = new Sprinkles(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);

            FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);

        }

    }

}

     

 

 

 

 

And the actual particle code:

 

 

@SideOnly(Side.CLIENT)

public class Sprinkles extends EntityFX

{

    public float portalParticleScale;

    public int last;

 

    public Sprinkles (World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int age)

    {

        super(par1World, par2, par4, par6, par8, par10, par12);

        this.last = age;

        this.motionX = par8 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        this.motionY = par10 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        this.motionZ = par12 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        float var14 = this.rand.nextFloat() * 0.6F + 0.4F;

        this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;

        this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14;

        this.particleGreen *= 0.3F;

        this.particleRed *= 0.9F;

        this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;

        this.particleMaxAge = (int)(16.0D / (this.rand.nextFloat() * 0.8D + 0.2D)) + 2;

    }

 

    /**

    * Called to update the entity's position/logic.

    */

    @Override

    public void onUpdate()

    {

        this.prevPosX = this.posX;

        this.prevPosY = this.posY;

        this.prevPosZ = this.posZ;

 

        if (this.particleAge++ >= this.particleMaxAge)

        {

            this.setDead();

        }

 

        this.setParticleTextureIndex(7 - this.particleAge * last / this.particleMaxAge);

        this.motionY += 0.004D;

        this.motionX *= 0.8999999761581421D;

        this.motionY *= 0.8999999761581421D;

        this.motionZ *= 0.8999999761581421D;

 

        if (this.onGround)

        {

            this.motionX *= 0.699999988079071D;

            this.motionZ *= 0.699999988079071D;

        }

    }

}

 

 

 

Posted

Hi

 

Do you know how to use the debugger?

 

If so, I'd suggest you keep trying until you get immortal particles, then put a breakpoint in Sprinkles.onUpdate and/or EffectRenderer.renderParticles.

 

That should hopefully give you a clue.

 

-TGG

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.