HugeExplosionSeedParticle .java

net.minecraft.client.particle.HugeExplosionSeedParticle (class): members: Provider, tick. imports: SimpleParticleType, ParticleTypes, ClientLevel.

net.minecraft.client.particleclass49 linesclientextends NoRenderParticle1.5 KB

API Surface (2)

void tick()
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)

Full Source

HugeExplosionSeedParticle.java49 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.ParticleTypes;
7
import net.minecraft.core.particles.SimpleParticleType;
8
import net.minecraft.util.RandomSource;
9
10
@Environment(EnvType.CLIENT)
11
public class HugeExplosionSeedParticle extends NoRenderParticle {
12
	private HugeExplosionSeedParticle(final ClientLevel level, final double x, final double y, final double z) {
13
		super(level, x, y, z, 0.0, 0.0, 0.0);
14
		this.lifetime = 8;
15
	}
16
17
	@Override
18
	public void tick() {
19
		for (int i = 0; i < 6; i++) {
20
			double xx = this.x + (this.random.nextDouble() - this.random.nextDouble()) * 4.0;
21
			double yy = this.y + (this.random.nextDouble() - this.random.nextDouble()) * 4.0;
22
			double zz = this.z + (this.random.nextDouble() - this.random.nextDouble()) * 4.0;
23
			this.level.addParticle(ParticleTypes.EXPLOSION, xx, yy, zz, (float)this.age / this.lifetime, 0.0, 0.0);
24
		}
25
26
		this.age++;
27
		if (this.age == this.lifetime) {
28
			this.remove();
29
		}
30
	}
31
32
	@Environment(EnvType.CLIENT)
33
	public static class Provider implements ParticleProvider<SimpleParticleType> {
34
		public Particle createParticle(
35
			final SimpleParticleType options,
36
			final ClientLevel level,
37
			final double x,
38
			final double y,
39
			final double z,
40
			final double xAux,
41
			final double yAux,
42
			final double zAux,
43
			final RandomSource random
44
		) {
45
			return new HugeExplosionSeedParticle(level, x, y, z);
46
		}
47
	}
48
}
49

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