TestBlockMode .java

net.minecraft.world.level.block.state.properties.TestBlockMode (enum): members: START, LOG, FAIL, ACCEPT, getDetailedMessage, detailedMessage, displayName.

net.minecraft.world.level.block.state.propertiesenum46 linescommon1.4 KB

Implements

API Surface (3)

String getSerializedName()
Component getDisplayName()
Component getDetailedMessage()

Fields & Constants (7)

BY_ID
CODEC
STREAM_CODEC
id
name
displayName
detailedMessage

String literals (5)

"start"
"fail"
"accept"
"test_block.mode."
"test_block.mode_info."

Code Graph: Dependencies (5)

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

Full Source

TestBlockMode.java46 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block.state.properties;
2
3
import com.mojang.serialization.Codec;
4
import io.netty.buffer.ByteBuf;
5
import java.util.function.IntFunction;
6
import net.minecraft.network.chat.Component;
7
import net.minecraft.network.codec.ByteBufCodecs;
8
import net.minecraft.network.codec.StreamCodec;
9
import net.minecraft.util.ByIdMap;
10
import net.minecraft.util.StringRepresentable;
11
12
public enum TestBlockMode implements StringRepresentable {
13
	START(0, "start"),
14
	LOG(1, "log"),
15
	FAIL(2, "fail"),
16
	ACCEPT(3, "accept");
17
18
	private static final IntFunction<TestBlockMode> BY_ID = ByIdMap.continuous(mode -> mode.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
19
	public static final Codec<TestBlockMode> CODEC = StringRepresentable.fromEnum(TestBlockMode::values);
20
	public static final StreamCodec<ByteBuf, TestBlockMode> STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, mode -> mode.id);
21
	private final int id;
22
	private final String name;
23
	private final Component displayName;
24
	private final Component detailedMessage;
25
26
	TestBlockMode(final int id, final String name) {
27
		this.id = id;
28
		this.name = name;
29
		this.displayName = Component.translatable("test_block.mode." + name);
30
		this.detailedMessage = Component.translatable("test_block.mode_info." + name);
31
	}
32
33
	@Override
34
	public String getSerializedName() {
35
		return this.name;
36
	}
37
38
	public Component getDisplayName() {
39
		return this.displayName;
40
	}
41
42
	public Component getDetailedMessage() {
43
		return this.detailedMessage;
44
	}
45
}
46

Decompiled Minecraft 26.3 source of TestBlockMode (net/minecraft/world/level/block/state/properties/TestBlockMode.java) with Mojang official mappings, stored verbatim on the site.