/* * 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.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; public class PlayerCloudParticle extends SingleQuadParticle { private final SpriteSet sprites; private PlayerCloudParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) { super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first()); float col; this.friction = 0.96f; this.sprites = sprites; float scale = 2.5f; this.xd *= (double)0.1f; this.yd *= (double)0.1f; this.zd *= (double)0.1f; this.xd += xa; this.yd += ya; this.zd += za; this.rCol = col = 1.0f - (float)(Math.random() * (double)0.3f); this.gCol = col; this.bCol = col; this.quadSize *= 1.875f; int baseLifetime = (int)(8.0 / (Math.random() * 0.8 + 0.3)); this.lifetime = (int)Math.max((float)baseLifetime * 2.5f, 1.0f); this.hasPhysics = false; this.setSpriteFromAge(sprites); } @Override public SingleQuadParticle.Layer getLayer() { return SingleQuadParticle.Layer.TRANSLUCENT; } @Override public float getQuadSize(float a) { return this.quadSize * Mth.clamp(((float)this.age + a) / (float)this.lifetime * 32.0f, 0.0f, 1.0f); } @Override public void tick() { super.tick(); if (!this.removed) { double playerY; this.setSpriteFromAge(this.sprites); Player player = this.level.getNearestPlayer(this.x, this.y, this.z, 2.0, false); if (player != null && this.y > (playerY = player.getY())) { this.y += (playerY - this.y) * 0.2; this.yd += (player.getDeltaMovement().y - this.yd) * 0.2; this.setPos(this.x, this.y, this.z); } } } public static class SneezeProvider implements ParticleProvider { private final SpriteSet sprites; public SneezeProvider(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) { PlayerCloudParticle particle = new PlayerCloudParticle(level, x, y, z, xAux, yAux, zAux, this.sprites); particle.setColor(0.22f, 1.0f, 0.53f); particle.setAlpha(0.4f); return particle; } } public static class Provider implements ParticleProvider { 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 PlayerCloudParticle(level, x, y, z, xAux, yAux, zAux, this.sprites); } } }