package net.minecraft.client.particle; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.SimpleParticleType; @Environment(EnvType.CLIENT) public class AttackSweepParticle extends TextureSheetParticle { private final SpriteSet sprites; AttackSweepParticle(ClientLevel level, double x, double y, double z, double quadSizeMultiplier, SpriteSet sprites) { super(level, x, y, z, 0.0, 0.0, 0.0); this.sprites = sprites; this.lifetime = 4; float f = this.random.nextFloat() * 0.6F + 0.4F; this.rCol = f; this.gCol = f; this.bCol = f; this.quadSize = 1.0F - (float)quadSizeMultiplier * 0.5F; this.setSpriteFromAge(sprites); } @Override public int getLightColor(float partialTick) { return 15728880; } @Override public void tick() { this.xo = this.x; this.yo = this.y; this.zo = this.z; if (this.age++ >= this.lifetime) { this.remove(); } else { this.setSpriteFromAge(this.sprites); } } @Override public ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } @Environment(EnvType.CLIENT) public static class Provider implements ParticleProvider { private final SpriteSet sprites; public Provider(SpriteSet sprites) { this.sprites = sprites; } public Particle createParticle(SimpleParticleType type, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new AttackSweepParticle(level, x, y, z, xSpeed, this.sprites); } } }