2025-11-24 22:52:51 +03:00

61 lines
2.1 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.particle;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.SingleQuadParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.util.RandomSource;
public class ExplodeParticle
extends SingleQuadParticle {
private final SpriteSet sprites;
protected ExplodeParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) {
super(level, x, y, z, sprites.first());
float col;
this.gravity = -0.1f;
this.friction = 0.9f;
this.sprites = sprites;
this.xd = xa + (Math.random() * 2.0 - 1.0) * (double)0.05f;
this.yd = ya + (Math.random() * 2.0 - 1.0) * (double)0.05f;
this.zd = za + (Math.random() * 2.0 - 1.0) * (double)0.05f;
this.rCol = col = this.random.nextFloat() * 0.3f + 0.7f;
this.gCol = col;
this.bCol = col;
this.quadSize = 0.1f * (this.random.nextFloat() * this.random.nextFloat() * 6.0f + 1.0f);
this.lifetime = (int)(16.0 / ((double)this.random.nextFloat() * 0.8 + 0.2)) + 2;
this.setSpriteFromAge(sprites);
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@Override
public void tick() {
super.tick();
this.setSpriteFromAge(this.sprites);
}
public static class Provider
implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprites;
public Provider(SpriteSet sprites) {
this.sprites = sprites;
}
@Override
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
return new ExplodeParticle(level, x, y, z, xAux, yAux, zAux, this.sprites);
}
}
}