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 WakeParticle extends TextureSheetParticle {
    private final SpriteSet sprites;
    
    private WakeParticle(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, 0.0, 0.0, 0.0);
        this.sprites = dpm;
        this.xd *= 0.30000001192092896;
        this.yd = Math.random() * 0.20000000298023224 + 0.10000000149011612;
        this.zd *= 0.30000001192092896;
        this.setSize(0.01f, 0.01f);
        this.lifetime = (int)(8.0 / (Math.random() * 0.8 + 0.2));
        this.setSpriteFromAge(dpm);
        this.gravity = 0.0f;
        this.xd = double5;
        this.yd = double6;
        this.zd = double7;
    }
    
    @Override
    public ParticleRenderType getRenderType() {
        return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
    }
    
    @Override
    public void tick() {
        this.xo = this.x;
        this.yo = this.y;
        this.zo = this.z;
        final int integer2 = 60 - this.lifetime;
        if (this.lifetime-- <= 0) {
            this.remove();
            return;
        }
        this.yd -= this.gravity;
        this.move(this.xd, this.yd, this.zd);
        this.xd *= 0.9800000190734863;
        this.yd *= 0.9800000190734863;
        this.zd *= 0.9800000190734863;
        final float float3 = integer2 * 0.001f;
        this.setSize(float3, float3);
        this.setSprite(this.sprites.get(integer2 % 4, 4));
    }
    
    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 WakeParticle(bjw, double3, double4, double5, double6, double7, double8, this.sprites, null);
        }
    }
}
