AttributeIdPrefixFix .java

net.minecraft.util.datafix.fixes.AttributeIdPrefixFix (class): members: PREFIXES. strings: "generic.", "player.", "zombie.", "horse.", "minecraft:".

net.minecraft.util.datafix.fixesclass27 linescommonextends AttributesRenameFix864 B

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (1)

PREFIXES

String literals (5)

"generic."
"horse."
"player."
"zombie."
"minecraft:"

Code Graph: Dependencies (2)

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

Full Source

AttributeIdPrefixFix.java27 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.schemas.Schema;
4
import java.util.List;
5
import net.minecraft.util.datafix.schemas.NamespacedSchema;
6
7
public class AttributeIdPrefixFix extends AttributesRenameFix {
8
	private static final List<String> PREFIXES = List.of("generic.", "horse.", "player.", "zombie.");
9
10
	public AttributeIdPrefixFix(final Schema outputSchema) {
11
		super(outputSchema, "AttributeIdPrefixFix", AttributeIdPrefixFix::replaceId, true);
12
	}
13
14
	private static String replaceId(final String id) {
15
		String namespacedId = NamespacedSchema.ensureNamespaced(id);
16
17
		for (String prefix : PREFIXES) {
18
			String namespacedPrefix = NamespacedSchema.ensureNamespaced(prefix);
19
			if (namespacedId.startsWith(namespacedPrefix)) {
20
				return "minecraft:" + namespacedId.substring(namespacedPrefix.length());
21
			}
22
		}
23
24
		return id;
25
	}
26
}
27

Decompiled Minecraft 26.3 source of AttributeIdPrefixFix (net/minecraft/util/datafix/fixes/AttributeIdPrefixFix.java) with Mojang official mappings, stored verbatim on the site.