GeyserParticleOptions .java

net.minecraft.core.particles.GeyserParticleOptions (record): members: waterBlocks, ByteBuf, streamCodec, getType, type, codec. strings: "water_blocks".

net.minecraft.core.particlesrecord27 linescommon1.1 KB

Implements

API Surface (3)

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

Fields & Constants (1)

ByteBuf

String literals (1)

"water_blocks"

Code Graph: Dependencies (5)

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

Full Source

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

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