BubbleColumnUpParticle .java

net.minecraft.client.particle.BubbleColumnUpParticle (class, 64 lines): members: za, getLayer, Provider, tick. imports: TextureAtlasSprite, FluidTags.

net.minecraft.client.particleclass64 linesclientextends SingleQuadParticle2.0 KB

API Surface (3)

void tick()
SingleQuadParticle.Layer getLayer()
Particle createParticle(final SimpleParticleType options, final ClientLevel level, final double x, final double y, final double z, final double xAux, final double yAux, final double zAux, final RandomSource random)

Fields & Constants (1)

za

Full Source

BubbleColumnUpParticle.java64 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.particle;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.multiplayer.ClientLevel;
6
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
7
import net.minecraft.core.BlockPos;
8
import net.minecraft.core.particles.SimpleParticleType;
9
import net.minecraft.tags.FluidTags;
10
import net.minecraft.util.RandomSource;
11
12
@Environment(EnvType.CLIENT)
13
public class BubbleColumnUpParticle extends SingleQuadParticle {
14
	private BubbleColumnUpParticle(
15
		final ClientLevel level, final double x, final double y, final double z, final double xa, final double ya, final double za, final TextureAtlasSprite sprite
16
	) {
17
		super(level, x, y, z, sprite);
18
		this.gravity = -0.125F;
19
		this.friction = 0.85F;
20
		this.setSize(0.02F, 0.02F);
21
		this.quadSize = this.quadSize * (this.random.nextFloat() * 0.6F + 0.2F);
22
		this.xd = xa * 0.2F + (this.random.nextFloat() * 2.0F - 1.0F) * 0.02F;
23
		this.yd = ya * 0.2F + (this.random.nextFloat() * 2.0F - 1.0F) * 0.02F;
24
		this.zd = za * 0.2F + (this.random.nextFloat() * 2.0F - 1.0F) * 0.02F;
25
		this.lifetime = (int)(40.0 / (this.random.nextFloat() * 0.8 + 0.2));
26
	}
27
28
	@Override
29
	public void tick() {
30
		super.tick();
31
		if (!this.removed && !this.level.getFluidState(BlockPos.containing(this.x, this.y, this.z)).is(FluidTags.WATER)) {
32
			this.remove();
33
		}
34
	}
35
36
	@Override
37
	public SingleQuadParticle.Layer getLayer() {
38
		return SingleQuadParticle.Layer.OPAQUE;
39
	}
40
41
	@Environment(EnvType.CLIENT)
42
	public static class Provider implements ParticleProvider<SimpleParticleType> {
43
		private final SpriteSet sprite;
44
45
		public Provider(final SpriteSet sprite) {
46
			this.sprite = sprite;
47
		}
48
49
		public Particle createParticle(
50
			final SimpleParticleType options,
51
			final ClientLevel level,
52
			final double x,
53
			final double y,
54
			final double z,
55
			final double xAux,
56
			final double yAux,
57
			final double zAux,
58
			final RandomSource random
59
		) {
60
			return new BubbleColumnUpParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
61
		}
62
	}
63
}
64

Decompiled Minecraft 26.3 source of BubbleColumnUpParticle (net/minecraft/client/particle/BubbleColumnUpParticle.java) with Mojang official mappings, stored verbatim on the site.