DustParticleBase .java

net.minecraft.client.particle.DustParticleBase (class): members: randomizeColor, zAux, xAux, yAux, getQuadSize, options, sprites, getLayer, level, tick.

net.minecraft.client.particleclass57 linesclientextends ScalableParticleOptionsBase>1.6 KB

API Surface (4)

float randomizeColor(final float color, final float baseFactor)
SingleQuadParticle.Layer getLayer()
float getQuadSize(final float a)
void tick()

Fields & Constants (9)

sprites
level
x
y
z
xAux
yAux
zAux
options

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

DustParticleBase.java57 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.core.particles.ScalableParticleOptionsBase;
7
import net.minecraft.util.Mth;
8
9
@Environment(EnvType.CLIENT)
10
public class DustParticleBase<T extends ScalableParticleOptionsBase> extends SingleQuadParticle {
11
	private final SpriteSet sprites;
12
13
	protected DustParticleBase(
14
		final ClientLevel level,
15
		final double x,
16
		final double y,
17
		final double z,
18
		final double xAux,
19
		final double yAux,
20
		final double zAux,
21
		final T options,
22
		final SpriteSet sprites
23
	) {
24
		super(level, x, y, z, xAux, yAux, zAux, sprites.first());
25
		this.friction = 0.96F;
26
		this.speedUpWhenYMotionIsBlocked = true;
27
		this.sprites = sprites;
28
		this.xd *= 0.1F;
29
		this.yd *= 0.1F;
30
		this.zd *= 0.1F;
31
		this.quadSize = this.quadSize * (0.75F * options.getScale());
32
		int baseLifetime = (int)(8.0 / (this.random.nextDouble() * 0.8 + 0.2));
33
		this.lifetime = (int)Math.max(baseLifetime * options.getScale(), 1.0F);
34
		this.setSpriteFromAge(sprites);
35
	}
36
37
	protected float randomizeColor(final float color, final float baseFactor) {
38
		return (this.random.nextFloat() * 0.2F + 0.8F) * color * baseFactor;
39
	}
40
41
	@Override
42
	public SingleQuadParticle.Layer getLayer() {
43
		return SingleQuadParticle.Layer.OPAQUE;
44
	}
45
46
	@Override
47
	public float getQuadSize(final float a) {
48
		return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 32.0F, 0.0F, 1.0F);
49
	}
50
51
	@Override
52
	public void tick() {
53
		super.tick();
54
		this.setSpriteFromAge(this.sprites);
55
	}
56
}
57

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