TrialSpawnerDetectionParticle .java

net.minecraft.client.particle.TrialSpawnerDetectionParticle (class, 94 lines): members: BASE_LIFETIME, getFacingCameraMode, xa, getQuadSize, ya, za, scale.

net.minecraft.client.particleclass94 linesclientextends SingleQuadParticle2.4 KB

API Surface (6)

SingleQuadParticle.Layer getLayer()
int getLightCoords(final float a)
SingleQuadParticle.FacingCameraMode getFacingCameraMode()
void tick()
float getQuadSize(final float a)
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 (10)

BASE_LIFETIME
sprites
level
x
y
z
xa
ya
za
scale

Full Source

TrialSpawnerDetectionParticle.java94 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.SimpleParticleType;
7
import net.minecraft.util.LightCoordsUtil;
8
import net.minecraft.util.Mth;
9
import net.minecraft.util.RandomSource;
10
11
@Environment(EnvType.CLIENT)
12
public class TrialSpawnerDetectionParticle extends SingleQuadParticle {
13
	private final SpriteSet sprites;
14
	private static final int BASE_LIFETIME = 8;
15
16
	protected TrialSpawnerDetectionParticle(
17
		final ClientLevel level,
18
		final double x,
19
		final double y,
20
		final double z,
21
		final double xa,
22
		final double ya,
23
		final double za,
24
		final float scale,
25
		final SpriteSet sprites
26
	) {
27
		super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first());
28
		this.sprites = sprites;
29
		this.friction = 0.96F;
30
		this.gravity = -0.1F;
31
		this.speedUpWhenYMotionIsBlocked = true;
32
		this.xd *= 0.0;
33
		this.yd *= 0.9;
34
		this.zd *= 0.0;
35
		this.xd += xa;
36
		this.yd += ya;
37
		this.zd += za;
38
		this.quadSize *= 0.75F * scale;
39
		this.lifetime = (int)(8.0F / Mth.randomBetween(this.random, 0.5F, 1.0F) * scale);
40
		this.lifetime = Math.max(this.lifetime, 1);
41
		this.setSpriteFromAge(sprites);
42
		this.hasPhysics = true;
43
	}
44
45
	@Override
46
	public SingleQuadParticle.Layer getLayer() {
47
		return SingleQuadParticle.Layer.OPAQUE;
48
	}
49
50
	@Override
51
	public int getLightCoords(final float a) {
52
		return LightCoordsUtil.withBlock(super.getLightCoords(a), 15);
53
	}
54
55
	@Override
56
	public SingleQuadParticle.FacingCameraMode getFacingCameraMode() {
57
		return SingleQuadParticle.FacingCameraMode.LOOKAT_Y;
58
	}
59
60
	@Override
61
	public void tick() {
62
		super.tick();
63
		this.setSpriteFromAge(this.sprites);
64
	}
65
66
	@Override
67
	public float getQuadSize(final float a) {
68
		return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 32.0F, 0.0F, 1.0F);
69
	}
70
71
	@Environment(EnvType.CLIENT)
72
	public static class Provider implements ParticleProvider<SimpleParticleType> {
73
		private final SpriteSet sprites;
74
75
		public Provider(final SpriteSet sprites) {
76
			this.sprites = sprites;
77
		}
78
79
		public Particle createParticle(
80
			final SimpleParticleType options,
81
			final ClientLevel level,
82
			final double x,
83
			final double y,
84
			final double z,
85
			final double xAux,
86
			final double yAux,
87
			final double zAux,
88
			final RandomSource random
89
		) {
90
			return new TrialSpawnerDetectionParticle(level, x, y, z, xAux, yAux, zAux, 1.5F, this.sprites);
91
		}
92
	}
93
}
94

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