/* * 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.BlockPos; import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; public class WaterCurrentDownParticle extends SingleQuadParticle { private float angle; private WaterCurrentDownParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) { super(level, x, y, z, sprite); this.lifetime = (int)(Math.random() * 60.0) + 30; this.hasPhysics = false; this.xd = 0.0; this.yd = -0.05; this.zd = 0.0; this.setSize(0.02f, 0.02f); this.quadSize *= this.random.nextFloat() * 0.6f + 0.2f; this.gravity = 0.002f; } @Override public SingleQuadParticle.Layer getLayer() { return SingleQuadParticle.Layer.OPAQUE; } @Override public void tick() { this.xo = this.x; this.yo = this.y; this.zo = this.z; if (this.age++ >= this.lifetime) { this.remove(); return; } float radius = 0.6f; this.xd += (double)(0.6f * Mth.cos(this.angle)); this.zd += (double)(0.6f * Mth.sin(this.angle)); this.xd *= 0.07; this.zd *= 0.07; this.move(this.xd, this.yd, this.zd); if (!this.level.getFluidState(BlockPos.containing(this.x, this.y, this.z)).is(FluidTags.WATER) || this.onGround) { this.remove(); } this.angle += 0.08f; } 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) { return new WaterCurrentDownParticle(level, x, y, z, this.sprite.get(random)); } } }