ModelLocationUtils .java

net.minecraft.client.data.models.model.ModelLocationUtils (class, 41 lines): members: decorateBlockModelLocation, decorateItemModelLocation. imports: Item.

net.minecraft.client.data.models.modelclass41 linesclient1.3 KB

API Surface (6)

Identifier decorateBlockModelLocation(final String id)
Identifier decorateItemModelLocation(final String id)
Identifier getModelLocation(final Block block, final String suffix)
Identifier getModelLocation(final Block block)
Identifier getModelLocation(final Item item)
Identifier getModelLocation(final Item item, final String suffix)

String literals (2)

"block/"
"item/"

Code Graph: Dependencies (4)

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

Full Source

ModelLocationUtils.java41 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.data.models.model;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.core.registries.BuiltInRegistries;
6
import net.minecraft.resources.Identifier;
7
import net.minecraft.world.item.Item;
8
import net.minecraft.world.level.block.Block;
9
10
@Environment(EnvType.CLIENT)
11
public class ModelLocationUtils {
12
	@Deprecated
13
	public static Identifier decorateBlockModelLocation(final String id) {
14
		return Identifier.withDefaultNamespace("block/" + id);
15
	}
16
17
	public static Identifier decorateItemModelLocation(final String id) {
18
		return Identifier.withDefaultNamespace("item/" + id);
19
	}
20
21
	public static Identifier getModelLocation(final Block block, final String suffix) {
22
		Identifier key = BuiltInRegistries.BLOCK.getKey(block);
23
		return key.withPath(path -> "block/" + path + suffix);
24
	}
25
26
	public static Identifier getModelLocation(final Block block) {
27
		Identifier key = BuiltInRegistries.BLOCK.getKey(block);
28
		return key.withPrefix("block/");
29
	}
30
31
	public static Identifier getModelLocation(final Item item) {
32
		Identifier key = BuiltInRegistries.ITEM.getKey(item);
33
		return key.withPrefix("item/");
34
	}
35
36
	public static Identifier getModelLocation(final Item item, final String suffix) {
37
		Identifier key = BuiltInRegistries.ITEM.getKey(item);
38
		return key.withPath(path -> "item/" + path + suffix);
39
	}
40
}
41

Decompiled Minecraft 26.3 source of ModelLocationUtils (net/minecraft/client/data/models/model/ModelLocationUtils.java) with Mojang official mappings, stored verbatim on the site.