SavedDataUUIDFix .java

net.minecraft.util.datafix.fixes.SavedDataUUIDFix (class): extends AbstractUUIDFix. members: makeRule, LOGGER. strings: "HeroesOfTheVillage", "UUIDLeast".

net.minecraft.util.datafix.fixesclass46 linescommonextends AbstractUUIDFix1.2 KB

API Surface (1)

TypeRewriteRule makeRule()

Fields & Constants (1)

LOGGER

String literals (5)

"Raids"
"HeroesOfTheVillage"
"UUIDMost"
"UUIDLeast"
"HeroesOfTheVillage contained invalid UUIDs."

Code Graph: Dependencies (1)

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

Full Source

SavedDataUUIDFix.java46 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.DSL;
4
import com.mojang.datafixers.TypeRewriteRule;
5
import com.mojang.datafixers.schemas.Schema;
6
import com.mojang.logging.LogUtils;
7
import com.mojang.serialization.Dynamic;
8
import org.slf4j.Logger;
9
10
public class SavedDataUUIDFix extends AbstractUUIDFix {
11
	private static final Logger LOGGER = LogUtils.getLogger();
12
13
	public SavedDataUUIDFix(final Schema outputSchema) {
14
		super(outputSchema, References.SAVED_DATA_RAIDS);
15
	}
16
17
	@Override
18
	protected TypeRewriteRule makeRule() {
19
		return this.fixTypeEverywhereTyped(
20
			"SavedDataUUIDFix",
21
			this.getInputSchema().getType(this.typeReference),
22
			input -> input.update(
23
				DSL.remainderFinder(),
24
				container -> container.update(
25
					"data",
26
					tag -> tag.update(
27
						"Raids",
28
						raids -> raids.createList(
29
							raids.asStream()
30
								.map(
31
									raid -> raid.update(
32
										"HeroesOfTheVillage",
33
										heros -> heros.createList(heros.asStream().map(hero -> createUUIDFromLongs((Dynamic<?>)hero, "UUIDMost", "UUIDLeast").orElseGet(() -> {
34
											LOGGER.warn("HeroesOfTheVillage contained invalid UUIDs.");
35
											return hero;
36
										})))
37
									)
38
								)
39
						)
40
					)
41
				)
42
			)
43
		);
44
	}
45
}
46

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