MapDecoration .java

net.minecraft.world.level.saveddata.maps.MapDecoration (record, 39 lines): members: rot, getSpriteLocation, renderOnFrame, name, STREAM_CODEC, type.

net.minecraft.world.level.saveddata.mapsrecord39 linescommon1.1 KB

API Surface (3)

record MapDecoration(Holder<MapDecorationType> type, byte x, byte y, byte rot, Optional<Component> name)
Identifier getSpriteLocation()
boolean renderOnFrame()

Fields & Constants (1)

STREAM_CODEC

Full Source

MapDecoration.java39 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.saveddata.maps;
2
3
import java.util.Optional;
4
import net.minecraft.core.Holder;
5
import net.minecraft.network.RegistryFriendlyByteBuf;
6
import net.minecraft.network.chat.Component;
7
import net.minecraft.network.chat.ComponentSerialization;
8
import net.minecraft.network.codec.ByteBufCodecs;
9
import net.minecraft.network.codec.StreamCodec;
10
import net.minecraft.resources.Identifier;
11
12
public record MapDecoration(Holder<MapDecorationType> type, byte x, byte y, byte rot, Optional<Component> name) {
13
	public static final StreamCodec<RegistryFriendlyByteBuf, MapDecoration> STREAM_CODEC = StreamCodec.composite(
14
		MapDecorationType.STREAM_CODEC,
15
		MapDecoration::type,
16
		ByteBufCodecs.BYTE,
17
		MapDecoration::x,
18
		ByteBufCodecs.BYTE,
19
		MapDecoration::y,
20
		ByteBufCodecs.BYTE,
21
		MapDecoration::rot,
22
		ComponentSerialization.OPTIONAL_STREAM_CODEC,
23
		MapDecoration::name,
24
		MapDecoration::new
25
	);
26
27
	public MapDecoration {
28
		rot = (byte)(rot & 15);
29
	}
30
31
	public Identifier getSpriteLocation() {
32
		return this.type.value().assetId();
33
	}
34
35
	public boolean renderOnFrame() {
36
		return this.type.value().showOnItemFrame();
37
	}
38
}
39

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