63 lines
1.9 KiB
Java
63 lines
1.9 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.core.particles.SimpleParticleType;
|
|
import net.minecraft.util.RandomSource;
|
|
|
|
public class BubblePopParticle
|
|
extends SingleQuadParticle {
|
|
private final SpriteSet sprites;
|
|
|
|
private BubblePopParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) {
|
|
super(level, x, y, z, sprites.first());
|
|
this.sprites = sprites;
|
|
this.lifetime = 4;
|
|
this.gravity = 0.008f;
|
|
this.xd = xa;
|
|
this.yd = ya;
|
|
this.zd = za;
|
|
this.setSpriteFromAge(sprites);
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
this.xo = this.x;
|
|
this.yo = this.y;
|
|
this.zo = this.z;
|
|
if (this.age++ >= this.lifetime) {
|
|
this.remove();
|
|
return;
|
|
}
|
|
this.yd -= (double)this.gravity;
|
|
this.move(this.xd, this.yd, this.zd);
|
|
this.setSpriteFromAge(this.sprites);
|
|
}
|
|
|
|
@Override
|
|
public SingleQuadParticle.Layer getLayer() {
|
|
return SingleQuadParticle.Layer.OPAQUE;
|
|
}
|
|
|
|
public static class Provider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprites;
|
|
|
|
public Provider(SpriteSet sprites) {
|
|
this.sprites = sprites;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
return new BubblePopParticle(level, x, y, z, xAux, yAux, zAux, this.sprites);
|
|
}
|
|
}
|
|
}
|
|
|