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

77 lines
2.3 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 GustParticle
extends SingleQuadParticle {
private final SpriteSet sprites;
protected GustParticle(ClientLevel level, double x, double y, double z, SpriteSet sprites) {
super(level, x, y, z, sprites.first());
this.sprites = sprites;
this.setSpriteFromAge(sprites);
this.lifetime = 12 + this.random.nextInt(4);
this.quadSize = 1.0f;
this.setSize(1.0f, 1.0f);
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@Override
public int getLightColor(float a) {
return 0xF000F0;
}
@Override
public void tick() {
if (this.age++ >= this.lifetime) {
this.remove();
return;
}
this.setSpriteFromAge(this.sprites);
}
public static class SmallProvider
implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprites;
public SmallProvider(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) {
GustParticle particle = new GustParticle(level, x, y, z, this.sprites);
((Particle)particle).scale(0.15f);
return particle;
}
}
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 GustParticle(level, x, y, z, this.sprites);
}
}
}