BannerPattern .java

net.minecraft.world.level.block.entity.BannerPattern (record): members: assetId, translationKey, DIRECT_STREAM_CODEC, DIRECT_CODEC, STREAM_CODEC, CODEC.

net.minecraft.world.level.block.entityrecord28 linescommon1.4 KB

API Surface (1)

record BannerPattern(Identifier assetId, String translationKey)

Fields & Constants (4)

DIRECT_CODEC
DIRECT_STREAM_CODEC
CODEC
STREAM_CODEC

String literals (2)

"asset_id"
"translation_key"

Code Graph: Dependencies (7)

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

Full Source

BannerPattern.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block.entity;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.core.Holder;
6
import net.minecraft.core.registries.Registries;
7
import net.minecraft.core.registries.codec.RegistryCodecs;
8
import net.minecraft.network.RegistryFriendlyByteBuf;
9
import net.minecraft.network.codec.ByteBufCodecs;
10
import net.minecraft.network.codec.StreamCodec;
11
import net.minecraft.resources.Identifier;
12
13
public record BannerPattern(Identifier assetId, String translationKey) {
14
	public static final Codec<BannerPattern> DIRECT_CODEC = RecordCodecBuilder.create(
15
		i -> i.group(
16
				Identifier.CODEC.fieldOf("asset_id").forGetter(BannerPattern::assetId), Codec.STRING.fieldOf("translation_key").forGetter(BannerPattern::translationKey)
17
			)
18
			.apply(i, BannerPattern::new)
19
	);
20
	public static final StreamCodec<RegistryFriendlyByteBuf, BannerPattern> DIRECT_STREAM_CODEC = StreamCodec.composite(
21
		Identifier.STREAM_CODEC, BannerPattern::assetId, ByteBufCodecs.STRING_UTF8, BannerPattern::translationKey, BannerPattern::new
22
	);
23
	public static final Codec<Holder<BannerPattern>> CODEC = RegistryCodecs.holder(Registries.BANNER_PATTERN, DIRECT_CODEC);
24
	public static final StreamCodec<RegistryFriendlyByteBuf, Holder<BannerPattern>> STREAM_CODEC = ByteBufCodecs.holder(
25
		Registries.BANNER_PATTERN, DIRECT_STREAM_CODEC
26
	);
27
}
28

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