package net.minecraft.client.particle; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class WaterCurrentDownParticle extends TextureSheetParticle { private float angle; WaterCurrentDownParticle(ClientLevel p_108450_, double p_108451_, double p_108452_, double p_108453_) { super(p_108450_, p_108451_, p_108452_, p_108453_); 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.quadSize * (this.random.nextFloat() * 0.6F + 0.2F); this.gravity = 0.002F; } @Override public ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @Override public void tick() { this.xo = this.x; this.yo = this.y; this.zo = this.z; if (this.age++ >= this.lifetime) { this.remove(); } else { float f = 0.6F; this.xd = this.xd + 0.6F * Mth.cos(this.angle); this.zd = this.zd + 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; } } @OnlyIn(Dist.CLIENT) public static class Provider implements ParticleProvider { private final SpriteSet sprite; public Provider(SpriteSet p_108464_) { this.sprite = p_108464_; } public Particle createParticle( SimpleParticleType p_108475_, ClientLevel p_108476_, double p_108477_, double p_108478_, double p_108479_, double p_108480_, double p_108481_, double p_108482_ ) { WaterCurrentDownParticle watercurrentdownparticle = new WaterCurrentDownParticle(p_108476_, p_108477_, p_108478_, p_108479_); watercurrentdownparticle.pickSprite(this.sprite); return watercurrentdownparticle; } } }