60 lines
2.2 KiB
Java
60 lines
2.2 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.BlockPos;
|
|
import net.minecraft.core.particles.SimpleParticleType;
|
|
import net.minecraft.tags.FluidTags;
|
|
import net.minecraft.util.RandomSource;
|
|
|
|
public class BubbleColumnUpParticle
|
|
extends SingleQuadParticle {
|
|
private BubbleColumnUpParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) {
|
|
super(level, x, y, z, sprite);
|
|
this.gravity = -0.125f;
|
|
this.friction = 0.85f;
|
|
this.setSize(0.02f, 0.02f);
|
|
this.quadSize *= this.random.nextFloat() * 0.6f + 0.2f;
|
|
this.xd = xa * (double)0.2f + (Math.random() * 2.0 - 1.0) * (double)0.02f;
|
|
this.yd = ya * (double)0.2f + (Math.random() * 2.0 - 1.0) * (double)0.02f;
|
|
this.zd = za * (double)0.2f + (Math.random() * 2.0 - 1.0) * (double)0.02f;
|
|
this.lifetime = (int)(40.0 / (Math.random() * 0.8 + 0.2));
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
super.tick();
|
|
if (!this.removed && !this.level.getFluidState(BlockPos.containing(this.x, this.y, this.z)).is(FluidTags.WATER)) {
|
|
this.remove();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public SingleQuadParticle.Layer getLayer() {
|
|
return SingleQuadParticle.Layer.OPAQUE;
|
|
}
|
|
|
|
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) {
|
|
BubbleColumnUpParticle particle = new BubbleColumnUpParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
|
|
return particle;
|
|
}
|
|
}
|
|
}
|
|
|