GeyserBaseParticleOptions .java

net.minecraft.core.particles.GeyserBaseParticleOptions (record): members: waterBlocks, burstImpulseBase, ByteBuf, streamCodec, getType, type, codec.

net.minecraft.core.particlesrecord37 linescommon1.4 KB

Implements

API Surface (3)

MapCodec<GeyserBaseParticleOptions> codec(final ParticleType<GeyserBaseParticleOptions> type)
StreamCodec<? super ByteBuf, GeyserBaseParticleOptions> streamCodec(final ParticleType<GeyserBaseParticleOptions> type)
ParticleType<GeyserBaseParticleOptions> getType()

Fields & Constants (1)

ByteBuf

String literals (2)

"water_blocks"
"burst_impulse_base"

Code Graph: Dependencies (5)

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

Full Source

GeyserBaseParticleOptions.java37 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.core.particles;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.MapCodec;
5
import com.mojang.serialization.codecs.RecordCodecBuilder;
6
import io.netty.buffer.ByteBuf;
7
import net.minecraft.network.codec.ByteBufCodecs;
8
import net.minecraft.network.codec.StreamCodec;
9
import net.minecraft.util.ExtraCodecs;
10
11
public record GeyserBaseParticleOptions(ParticleType<GeyserBaseParticleOptions> type, int waterBlocks, float burstImpulseBase) implements ParticleOptions {
12
	public static MapCodec<GeyserBaseParticleOptions> codec(final ParticleType<GeyserBaseParticleOptions> type) {
13
		return RecordCodecBuilder.mapCodec(
14
			i -> i.group(
15
					ExtraCodecs.POSITIVE_INT.fieldOf("water_blocks").forGetter(o -> o.waterBlocks),
16
					Codec.FLOAT.fieldOf("burst_impulse_base").forGetter(o -> o.burstImpulseBase)
17
				)
18
				.apply(i, (waterBlocks, burstImpulseBase) -> new GeyserBaseParticleOptions(type, waterBlocks, burstImpulseBase))
19
		);
20
	}
21
22
	public static StreamCodec<? super ByteBuf, GeyserBaseParticleOptions> streamCodec(final ParticleType<GeyserBaseParticleOptions> type) {
23
		return StreamCodec.composite(
24
			ByteBufCodecs.INT,
25
			o -> o.waterBlocks,
26
			ByteBufCodecs.FLOAT,
27
			o -> o.burstImpulseBase,
28
			(waterBlocks, burstImpulseBase) -> new GeyserBaseParticleOptions(type, waterBlocks, burstImpulseBase)
29
		);
30
	}
31
32
	@Override
33
	public ParticleType<GeyserBaseParticleOptions> getType() {
34
		return this.type;
35
	}
36
}
37

Decompiled Minecraft 26.3 source of GeyserBaseParticleOptions (net/minecraft/core/particles/GeyserBaseParticleOptions.java) with Mojang official mappings, stored verbatim on the site.