HugeExplosionParticle .java

net.minecraft.client.particle.HugeExplosionParticle (class, 70 lines): members: getLightCoords, sprites, getLayer, Provider, tick. imports: ClientLevel.

net.minecraft.client.particleclass70 linesclientextends SingleQuadParticle1.8 KB

API Surface (4)

int getLightCoords(final float a)
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)

sprites

Full Source

HugeExplosionParticle.java70 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.RandomSource;
8
9
@Environment(EnvType.CLIENT)
10
public class HugeExplosionParticle extends SingleQuadParticle {
11
	private final SpriteSet sprites;
12
13
	protected HugeExplosionParticle(final ClientLevel level, final double x, final double y, final double z, final double size, final SpriteSet sprites) {
14
		super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first());
15
		this.lifetime = 6 + this.random.nextInt(4);
16
		float col = this.random.nextFloat() * 0.6F + 0.4F;
17
		this.rCol = col;
18
		this.gCol = col;
19
		this.bCol = col;
20
		this.quadSize = 2.0F * (1.0F - (float)size * 0.5F);
21
		this.sprites = sprites;
22
		this.setSpriteFromAge(sprites);
23
	}
24
25
	@Override
26
	public int getLightCoords(final float a) {
27
		return 15728880;
28
	}
29
30
	@Override
31
	public void tick() {
32
		this.xo = this.x;
33
		this.yo = this.y;
34
		this.zo = this.z;
35
		if (this.age++ >= this.lifetime) {
36
			this.remove();
37
		} else {
38
			this.setSpriteFromAge(this.sprites);
39
		}
40
	}
41
42
	@Override
43
	public SingleQuadParticle.Layer getLayer() {
44
		return SingleQuadParticle.Layer.OPAQUE;
45
	}
46
47
	@Environment(EnvType.CLIENT)
48
	public static class Provider implements ParticleProvider<SimpleParticleType> {
49
		private final SpriteSet sprites;
50
51
		public Provider(final SpriteSet sprites) {
52
			this.sprites = sprites;
53
		}
54
55
		public Particle createParticle(
56
			final SimpleParticleType options,
57
			final ClientLevel level,
58
			final double x,
59
			final double y,
60
			final double z,
61
			final double xAux,
62
			final double yAux,
63
			final double zAux,
64
			final RandomSource random
65
		) {
66
			return new HugeExplosionParticle(level, x, y, z, xAux, this.sprites);
67
		}
68
	}
69
}
70

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