minecraft-src/net/minecraft/client/particle/HugeExplosionSeedParticle.java
2025-07-04 03:15:13 +03:00

37 lines
1.3 KiB
Java

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.ParticleTypes;
import net.minecraft.core.particles.SimpleParticleType;
@Environment(EnvType.CLIENT)
public class HugeExplosionSeedParticle extends NoRenderParticle {
HugeExplosionSeedParticle(ClientLevel clientLevel, double d, double e, double f) {
super(clientLevel, d, e, f, 0.0, 0.0, 0.0);
this.lifetime = 8;
}
@Override
public void tick() {
for (int i = 0; i < 6; i++) {
double d = this.x + (this.random.nextDouble() - this.random.nextDouble()) * 4.0;
double e = this.y + (this.random.nextDouble() - this.random.nextDouble()) * 4.0;
double f = this.z + (this.random.nextDouble() - this.random.nextDouble()) * 4.0;
this.level.addParticle(ParticleTypes.EXPLOSION, d, e, f, (float)this.age / this.lifetime, 0.0, 0.0);
}
this.age++;
if (this.age == this.lifetime) {
this.remove();
}
}
@Environment(EnvType.CLIENT)
public static class Provider implements ParticleProvider<SimpleParticleType> {
public Particle createParticle(SimpleParticleType type, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
return new HugeExplosionSeedParticle(level, x, y, z);
}
}
}