TrimMaterials .java

net.minecraft.world.item.equipment.trim.TrimMaterials (class): members: hoverTextStyle, AMETHYST, Palette, LAPIS, RESIN, EMERALD, NETHERITE, REDSTONE.

net.minecraft.world.item.equipment.trimclass84 linescommon3.6 KB

API Surface (3)

void bootstrap(final BootstrapContext<TrimMaterial> context)
String suffix()
Identifier id()

Fields & Constants (12)

QUARTZ
IRON
NETHERITE
REDSTONE
COPPER
GOLD
EMERALD
DIAMOND
LAPIS
AMETHYST
RESIN
hoverTextStyle

String literals (18)

"quartz"
"iron"
"netherite"
"redstone"
"copper"
"gold"
"emerald"
"diamond"
"lapis"
"amethyst"
"resin"
"trim_material"
"iron_darker"
"netherite_darker"
"copper_darker"
"gold_darker"
"diamond_darker"
"trim/"

Full Source

TrimMaterials.java84 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item.equipment.trim;
2
3
import net.minecraft.core.registries.Registries;
4
import net.minecraft.data.worldgen.BootstrapContext;
5
import net.minecraft.network.chat.Component;
6
import net.minecraft.network.chat.Style;
7
import net.minecraft.resources.Identifier;
8
import net.minecraft.resources.ResourceKey;
9
import net.minecraft.util.Util;
10
11
public class TrimMaterials {
12
	public static final ResourceKey<TrimMaterial> QUARTZ = registryKey("quartz");
13
	public static final ResourceKey<TrimMaterial> IRON = registryKey("iron");
14
	public static final ResourceKey<TrimMaterial> NETHERITE = registryKey("netherite");
15
	public static final ResourceKey<TrimMaterial> REDSTONE = registryKey("redstone");
16
	public static final ResourceKey<TrimMaterial> COPPER = registryKey("copper");
17
	public static final ResourceKey<TrimMaterial> GOLD = registryKey("gold");
18
	public static final ResourceKey<TrimMaterial> EMERALD = registryKey("emerald");
19
	public static final ResourceKey<TrimMaterial> DIAMOND = registryKey("diamond");
20
	public static final ResourceKey<TrimMaterial> LAPIS = registryKey("lapis");
21
	public static final ResourceKey<TrimMaterial> AMETHYST = registryKey("amethyst");
22
	public static final ResourceKey<TrimMaterial> RESIN = registryKey("resin");
23
24
	public static void bootstrap(final BootstrapContext<TrimMaterial> context) {
25
		register(context, QUARTZ, Style.EMPTY.withColor(14931140), TrimMaterials.Palette.QUARTZ);
26
		register(context, IRON, Style.EMPTY.withColor(15527148), TrimMaterials.Palette.IRON);
27
		register(context, NETHERITE, Style.EMPTY.withColor(6445145), TrimMaterials.Palette.NETHERITE);
28
		register(context, REDSTONE, Style.EMPTY.withColor(9901575), TrimMaterials.Palette.REDSTONE);
29
		register(context, COPPER, Style.EMPTY.withColor(11823181), TrimMaterials.Palette.COPPER);
30
		register(context, GOLD, Style.EMPTY.withColor(14594349), TrimMaterials.Palette.GOLD);
31
		register(context, EMERALD, Style.EMPTY.withColor(1155126), TrimMaterials.Palette.EMERALD);
32
		register(context, DIAMOND, Style.EMPTY.withColor(7269586), TrimMaterials.Palette.DIAMOND);
33
		register(context, LAPIS, Style.EMPTY.withColor(4288151), TrimMaterials.Palette.LAPIS);
34
		register(context, AMETHYST, Style.EMPTY.withColor(10116294), TrimMaterials.Palette.AMETHYST);
35
		register(context, RESIN, Style.EMPTY.withColor(16545810), TrimMaterials.Palette.RESIN);
36
	}
37
38
	private static void register(
39
		final BootstrapContext<TrimMaterial> context, final ResourceKey<TrimMaterial> registryKey, final Style hoverTextStyle, final TrimMaterials.Palette palette
40
	) {
41
		Component description = Component.translatable(Util.makeDescriptionId("trim_material", registryKey.identifier())).withStyle(hoverTextStyle);
42
		context.register(registryKey, new TrimMaterial(palette.id(), description));
43
	}
44
45
	private static ResourceKey<TrimMaterial> registryKey(final String id) {
46
		return ResourceKey.create(Registries.TRIM_MATERIAL, Identifier.withDefaultNamespace(id));
47
	}
48
49
	public enum Palette {
50
		QUARTZ("quartz"),
51
		IRON("iron"),
52
		IRON_DARKER("iron_darker"),
53
		NETHERITE("netherite"),
54
		NETHERITE_DARKER("netherite_darker"),
55
		REDSTONE("redstone"),
56
		COPPER("copper"),
57
		COPPER_DARKER("copper_darker"),
58
		GOLD("gold"),
59
		GOLD_DARKER("gold_darker"),
60
		EMERALD("emerald"),
61
		DIAMOND("diamond"),
62
		DIAMOND_DARKER("diamond_darker"),
63
		LAPIS("lapis"),
64
		AMETHYST("amethyst"),
65
		RESIN("resin");
66
67
		private final String suffix;
68
		private final Identifier id;
69
70
		Palette(final String name) {
71
			this.suffix = name;
72
			this.id = Identifier.withDefaultNamespace("trim/" + name);
73
		}
74
75
		public String suffix() {
76
			return this.suffix;
77
		}
78
79
		public Identifier id() {
80
			return this.id;
81
		}
82
	}
83
}
84

Decompiled Minecraft 26.3 source of TrimMaterials (net/minecraft/world/item/equipment/trim/TrimMaterials.java) with Mojang official mappings, stored verbatim on the site.