2025-11-24 22:52:51 +03:00

73 lines
2.5 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.particle;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.SingleQuadParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
public class HeartParticle
extends SingleQuadParticle {
private HeartParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) {
super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
this.speedUpWhenYMotionIsBlocked = true;
this.friction = 0.86f;
this.xd *= (double)0.01f;
this.yd *= (double)0.01f;
this.zd *= (double)0.01f;
this.yd += 0.1;
this.quadSize *= 1.5f;
this.lifetime = 16;
this.hasPhysics = false;
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@Override
public float getQuadSize(float a) {
return this.quadSize * Mth.clamp(((float)this.age + a) / (float)this.lifetime * 32.0f, 0.0f, 1.0f);
}
public static class AngryVillagerProvider
implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public AngryVillagerProvider(SpriteSet sprite) {
this.sprite = sprite;
}
@Override
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
HeartParticle particle = new HeartParticle(level, x, y + 0.5, z, this.sprite.get(random));
particle.setColor(1.0f, 1.0f, 1.0f);
return particle;
}
}
public static class Provider
implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public Provider(SpriteSet sprite) {
this.sprite = sprite;
}
@Override
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
HeartParticle particle = new HeartParticle(level, x, y, z, this.sprite.get(random));
return particle;
}
}
}