Jump to content

1.21 Setting particle properties yields no changes


Recommended Posts

I'm having trouble with a custom particle I've made. The particle itself is registered and functions, however when I try to change any of its attributes in its constructor (size, color, etc...) I observe no changes whatsoever. I'm pretty confused, so I've included the code for the particle class here. Any help would be great.

 

package com.gmail.damoruso321.bomb.particles;

import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.SmokeParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

public class GasParticle extends SmokeParticle {
    protected GasParticle(ClientLevel p_107685_, double p_107686_, double p_107687_, double p_107688_, double p_107689_, double p_107690_, double p_107691_, float p_107692_, SpriteSet p_107693_) {
        super(p_107685_, p_107686_, p_107687_, p_107688_, p_107689_, p_107690_, p_107691_, p_107692_, p_107693_);

        // This doesn't work for some reason...
        this.rCol = 0f;
        this.gCol = 1f;
        this.bCol = 0f;

        this.quadSize *= 100f;
    }

    @OnlyIn(Dist.CLIENT)
    public static class Provider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprites;

        public Provider(SpriteSet p_107696_) {
            this.sprites = p_107696_;
        }

        public Particle createParticle(SimpleParticleType p_107707_, ClientLevel p_107708_, double p_107709_, double p_107710_, double p_107711_, double p_107712_, double p_107713_, double p_107714_) {
            return new GasParticle(p_107708_, p_107709_, p_107710_, p_107711_, p_107712_, p_107713_, p_107714_, 1.0F, this.sprites);
        }
    }
}

 

Link to comment
Share on other sites

So I actually managed to fix this issue. I have absolutely no idea why it suddenly started showing changes for me other than changing the createParticle method to create an instance of the particle before returning it. 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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