package com.atsuishio.superbwarfare.client.particle; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.*; import net.minecraft.core.particles.SimpleParticleType; import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.OnlyIn; import org.jetbrains.annotations.NotNull; @OnlyIn(Dist.CLIENT) public class CustomCloudParticle extends TextureSheetParticle { public static FireStarParticleProvider provider(SpriteSet spriteSet) { return new FireStarParticleProvider(spriteSet); } public static class FireStarParticleProvider implements ParticleProvider { private final SpriteSet spriteSet; public FireStarParticleProvider(SpriteSet spriteSet) { this.spriteSet = spriteSet; } public Particle createParticle(@NotNull SimpleParticleType typeIn, @NotNull ClientLevel worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new CustomCloudParticle(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet); } } private final SpriteSet spriteSet; protected CustomCloudParticle(ClientLevel world, double x, double y, double z, double vx, double vy, double vz, SpriteSet spriteSet) { super(world, x, y, z); this.spriteSet = spriteSet; this.setSize(0.2f, 0.2f); this.quadSize *= 0.5f; this.lifetime = Math.max(1, 40 + (this.random.nextInt(40) - 20)); this.gravity = -0.1f; this.hasPhysics = false; this.xd = vx * 1; this.yd = vy * 1; this.zd = vz * 1; this.setSpriteFromAge(spriteSet); } @Override public int getLightColor(float partialTick) { return 15728880; } @Override public @NotNull ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } @Override public void tick() { super.tick(); if (!this.removed) { this.setSprite(this.spriteSet.get((this.age / 2) % 4 + 1, 4)); } } }