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

85 lines
2.8 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.RisingParticle;
import net.minecraft.client.particle.SingleQuadParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
public class FlameParticle
extends RisingParticle {
private FlameParticle(ClientLevel level, double x, double y, double z, double xd, double yd, double zd, TextureAtlasSprite sprite) {
super(level, x, y, z, xd, yd, zd, sprite);
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@Override
public void move(double xa, double ya, double za) {
this.setBoundingBox(this.getBoundingBox().move(xa, ya, za));
this.setLocationFromBoundingbox();
}
@Override
public float getQuadSize(float a) {
float s = ((float)this.age + a) / (float)this.lifetime;
return this.quadSize * (1.0f - s * s * 0.5f);
}
@Override
public int getLightColor(float a) {
float l = ((float)this.age + a) / (float)this.lifetime;
l = Mth.clamp(l, 0.0f, 1.0f);
int br = super.getLightColor(a);
int br1 = br & 0xFF;
int br2 = br >> 16 & 0xFF;
if ((br1 += (int)(l * 15.0f * 16.0f)) > 240) {
br1 = 240;
}
return br1 | br2 << 16;
}
public static class SmallFlameProvider
implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public SmallFlameProvider(SpriteSet sprite) {
this.sprite = sprite;
}
@Override
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
FlameParticle particle = new FlameParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
particle.scale(0.5f);
return particle;
}
}
public static class Provider
implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public Provider(SpriteSet sprite) {
this.sprite = sprite;
}
@Override
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
FlameParticle particle = new FlameParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
return particle;
}
}
}