BlockEntityUUIDFix .java

net.minecraft.util.datafix.fixes.BlockEntityUUIDFix (class): members: makeRule. strings: "target_uuid", "minecraft:conduit", "SkullOwner", "Target".

net.minecraft.util.datafix.fixesclass33 linescommonextends AbstractUUIDFix1.1 KB

API Surface (1)

TypeRewriteRule makeRule()

String literals (6)

"minecraft:conduit"
"minecraft:skull"
"Owner"
"SkullOwner"
"target_uuid"
"Target"

Code Graph: Dependencies (1)

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

Full Source

BlockEntityUUIDFix.java33 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.TypeRewriteRule;
4
import com.mojang.datafixers.schemas.Schema;
5
import com.mojang.serialization.Dynamic;
6
7
public class BlockEntityUUIDFix extends AbstractUUIDFix {
8
	public BlockEntityUUIDFix(final Schema outputSchema) {
9
		super(outputSchema, References.BLOCK_ENTITY);
10
	}
11
12
	@Override
13
	protected TypeRewriteRule makeRule() {
14
		return this.fixTypeEverywhereTyped("BlockEntityUUIDFix", this.getInputSchema().getType(this.typeReference), input -> {
15
			input = this.updateNamedChoice(input, "minecraft:conduit", this::updateConduit);
16
			return this.updateNamedChoice(input, "minecraft:skull", this::updateSkull);
17
		});
18
	}
19
20
	private Dynamic<?> updateSkull(final Dynamic<?> tag) {
21
		return tag.get("Owner")
22
			.get()
23
			.map(ownerTag -> replaceUUIDString((Dynamic<?>)ownerTag, "Id", "Id").orElse((Dynamic<?>)ownerTag))
24
			.map(ownerTag -> tag.remove("Owner").set("SkullOwner", (Dynamic<?>)ownerTag))
25
			.result()
26
			.orElse(tag);
27
	}
28
29
	private Dynamic<?> updateConduit(final Dynamic<?> tag) {
30
		return replaceUUIDMLTag(tag, "target_uuid", "Target").orElse(tag);
31
	}
32
}
33

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