public record VillagerMetadataSection(VillagerMetadataSection.Hat hat) {
12
public static final Codec<VillagerMetadataSection> CODEC = RecordCodecBuilder.create(
13
i -> i.group(VillagerMetadataSection.Hat.CODEC.optionalFieldOf("hat", VillagerMetadataSection.Hat.NONE).forGetter(VillagerMetadataSection::hat))
14
.apply(i, VillagerMetadataSection::new)
15
);
16
public static final MetadataSectionType<VillagerMetadataSection> TYPE = new MetadataSectionType<>("villager", CODEC);
17
18
@Environment(EnvType.CLIENT)
19
public enum Hat implements StringRepresentable {
20
NONE("none"),
21
PARTIAL("partial"),
22
FULL("full");
23
24
public static final Codec<VillagerMetadataSection.Hat> CODEC = StringRepresentable.fromEnum(VillagerMetadataSection.Hat::values);
25
private final String name;
26
27
Hat(final String name) {
28
this.name = name;
29
}
30
31
@Override
32
public String getSerializedName() {
33
return this.name;
34
}
35
}
36
}
37
Decompiled Minecraft 26.3 source of VillagerMetadataSection (net/minecraft/client/resources/metadata/animation/VillagerMetadataSection.java) with Mojang official mappings, stored verbatim on the site.