package net.minecraft.client.particle;

import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.world.level.Level;

public class BubblePopParticle extends TextureSheetParticle {
    private final SpriteSet sprites;
    
    private BubblePopParticle(final Level bjw, final double double2, final double double3, final double double4, final double double5, final double double6, final double double7, final SpriteSet dpm) {
        super(bjw, double2, double3, double4);
        this.sprites = dpm;
        this.lifetime = 4;
        this.gravity = 0.008f;
        this.xd = double5;
        this.yd = double6;
        this.zd = double7;
        this.setSpriteFromAge(dpm);
    }
    
    @Override
    public void tick() {
        this.xo = this.x;
        this.yo = this.y;
        this.zo = this.z;
        if (this.age++ >= this.lifetime) {
            this.remove();
            return;
        }
        this.yd -= this.gravity;
        this.move(this.xd, this.yd, this.zd);
        this.setSpriteFromAge(this.sprites);
    }
    
    @Override
    public ParticleRenderType getRenderType() {
        return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
    }
    
    public static class Provider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprites;
        
        public Provider(final SpriteSet dpm) {
            this.sprites = dpm;
        }
        
        @Override
        public Particle createParticle(final SimpleParticleType gw, final Level bjw, final double double3, final double double4, final double double5, final double double6, final double double7, final double double8) {
            return new BubblePopParticle(bjw, double3, double4, double5, double6, double7, double8, this.sprites, null);
        }
    }
}
