MapBannerBlockPosFormatFix .java

net.minecraft.util.datafix.fixes.MapBannerBlockPosFormatFix (class): members: makeRule. strings: "banners". imports: ListType, ExtraDataFixUtils, Type.

net.minecraft.util.datafix.fixesclass38 linescommonextends DataFix1.2 KB

API Surface (1)

TypeRewriteRule makeRule()

String literals (1)

"banners"

Code Graph: Dependencies (1)

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

Full Source

MapBannerBlockPosFormatFix.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.DSL;
4
import com.mojang.datafixers.DataFix;
5
import com.mojang.datafixers.OpticFinder;
6
import com.mojang.datafixers.TypeRewriteRule;
7
import com.mojang.datafixers.schemas.Schema;
8
import com.mojang.datafixers.types.Type;
9
import com.mojang.datafixers.types.templates.List.ListType;
10
import net.minecraft.util.datafix.ExtraDataFixUtils;
11
12
public class MapBannerBlockPosFormatFix extends DataFix {
13
	public MapBannerBlockPosFormatFix(final Schema outputSchema) {
14
		super(outputSchema, false);
15
	}
16
17
	@Override
18
	protected TypeRewriteRule makeRule() {
19
		Type<?> type = this.getInputSchema().getType(References.SAVED_DATA_MAP_DATA);
20
		OpticFinder<?> dataF = type.findField("data");
21
		OpticFinder<?> bannersF = dataF.type().findField("banners");
22
		OpticFinder<?> bannerF = DSL.typeFinder(((ListType)bannersF.type()).getElement());
23
		return this.fixTypeEverywhereTyped(
24
			"MapBannerBlockPosFormatFix",
25
			type,
26
			input -> input.updateTyped(
27
				dataF,
28
				data -> data.updateTyped(
29
					bannersF,
30
					banners -> banners.updateTyped(
31
						bannerF, banner -> banner.update(DSL.remainderFinder(), bannerTag -> bannerTag.update("Pos", ExtraDataFixUtils::fixBlockPos))
32
					)
33
				)
34
			)
35
		);
36
	}
37
}
38

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