/* * 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.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.util.RandomSource; public class LavaParticle extends SingleQuadParticle { private LavaParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) { super(level, x, y, z, 0.0, 0.0, 0.0, sprite); this.gravity = 0.75f; this.friction = 0.999f; this.xd *= (double)0.8f; this.yd *= (double)0.8f; this.zd *= (double)0.8f; this.yd = this.random.nextFloat() * 0.4f + 0.05f; this.quadSize *= this.random.nextFloat() * 2.0f + 0.2f; this.lifetime = (int)(16.0 / (Math.random() * 0.8 + 0.2)); } @Override public SingleQuadParticle.Layer getLayer() { return SingleQuadParticle.Layer.OPAQUE; } @Override public int getLightColor(float a) { int br = super.getLightColor(a); int br1 = 240; int br2 = br >> 16 & 0xFF; return 0xF0 | br2 << 16; } @Override public float getQuadSize(float a) { float s = ((float)this.age + a) / (float)this.lifetime; return this.quadSize * (1.0f - s * s); } @Override public void tick() { super.tick(); if (!this.removed) { float odds = (float)this.age / (float)this.lifetime; if (this.random.nextFloat() > odds) { this.level.addParticle(ParticleTypes.SMOKE, this.x, this.y, this.z, this.xd, this.yd, this.zd); } } } public static class Provider implements ParticleProvider { 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) { LavaParticle particle = new LavaParticle(level, x, y, z, this.sprite.get(random)); return particle; } } }