Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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;

        }

    }

}

 

 

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.