PowerParticleOption .java

net.minecraft.core.particles.PowerParticleOption (class): members: getPower, power, ByteBuf, streamCodec, getType, create, type, codec. strings: "power".

net.minecraft.core.particlesclass39 linescommon1.3 KB

Implements

API Surface (5)

MapCodec<PowerParticleOption> codec(final ParticleType<PowerParticleOption> type)
StreamCodec<? super ByteBuf, PowerParticleOption> streamCodec(final ParticleType<PowerParticleOption> type)
ParticleType<PowerParticleOption> getType()
float getPower()
PowerParticleOption create(final ParticleType<PowerParticleOption> type, final float power)

Fields & Constants (3)

ByteBuf
type
power

String literals (1)

"power"

Code Graph: Dependencies (4)

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

Full Source

PowerParticleOption.java39 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 io.netty.buffer.ByteBuf;
6
import net.minecraft.network.codec.ByteBufCodecs;
7
import net.minecraft.network.codec.StreamCodec;
8
9
public class PowerParticleOption implements ParticleOptions {
10
	private final ParticleType<PowerParticleOption> type;
11
	private final float power;
12
13
	public static MapCodec<PowerParticleOption> codec(final ParticleType<PowerParticleOption> type) {
14
		return Codec.FLOAT.xmap(power -> new PowerParticleOption(type, power), o -> o.power).optionalFieldOf("power", create(type, 1.0F));
15
	}
16
17
	public static StreamCodec<? super ByteBuf, PowerParticleOption> streamCodec(final ParticleType<PowerParticleOption> type) {
18
		return ByteBufCodecs.FLOAT.map(color -> new PowerParticleOption(type, color), o -> o.power);
19
	}
20
21
	private PowerParticleOption(final ParticleType<PowerParticleOption> type, final float power) {
22
		this.type = type;
23
		this.power = power;
24
	}
25
26
	@Override
27
	public ParticleType<PowerParticleOption> getType() {
28
		return this.type;
29
	}
30
31
	public float getPower() {
32
		return this.power;
33
	}
34
35
	public static PowerParticleOption create(final ParticleType<PowerParticleOption> type, final float power) {
36
		return new PowerParticleOption(type, power);
37
	}
38
}
39

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