minecraft-src/net/minecraft/client/particle/TotemParticle.java
2025-07-04 01:41:11 +03:00

38 lines
1.4 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.SimpleParticleType;
@Environment(EnvType.CLIENT)
public class TotemParticle extends SimpleAnimatedParticle {
TotemParticle(ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, SpriteSet sprites) {
super(level, x, y, z, sprites, 1.25F);
this.friction = 0.6F;
this.xd = xSpeed;
this.yd = ySpeed;
this.zd = zSpeed;
this.quadSize *= 0.75F;
this.lifetime = 60 + this.random.nextInt(12);
this.setSpriteFromAge(sprites);
if (this.random.nextInt(4) == 0) {
this.setColor(0.6F + this.random.nextFloat() * 0.2F, 0.6F + this.random.nextFloat() * 0.3F, this.random.nextFloat() * 0.2F);
} else {
this.setColor(0.1F + this.random.nextFloat() * 0.2F, 0.4F + this.random.nextFloat() * 0.3F, this.random.nextFloat() * 0.2F);
}
}
@Environment(EnvType.CLIENT)
public static class Provider implements ParticleProvider<SimpleParticleType> {
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 TotemParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.sprites);
}
}
}