PotDecorationsBlockEntityUnflatteningFix .java

net.minecraft.util.datafix.fixes.PotDecorationsBlockEntityUnflatteningFix (class, 23 lines): members: fix. strings: "sherds", "minecraft:decorated_pot".

net.minecraft.util.datafix.fixesclass23 linescommonextends NamedEntityFix951 B

API Surface (1)

Typed<?> fix(final Typed<?> entity)

String literals (2)

"minecraft:decorated_pot"
"sherds"

Code Graph: Dependencies (3)

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

Full Source

PotDecorationsBlockEntityUnflatteningFix.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.Typed;
4
import com.mojang.datafixers.schemas.Schema;
5
import com.mojang.datafixers.types.Type;
6
import com.mojang.serialization.Dynamic;
7
import net.minecraft.util.Util;
8
9
public class PotDecorationsBlockEntityUnflatteningFix extends NamedEntityFix {
10
	public PotDecorationsBlockEntityUnflatteningFix(final Schema outputSchema) {
11
		super(outputSchema, true, "PotDecorationsBlockEntityUnflatteningFix", References.BLOCK_ENTITY, "minecraft:decorated_pot");
12
	}
13
14
	@Override
15
	protected Typed<?> fix(final Typed<?> entity) {
16
		Type<?> newType = this.getOutputSchema().findChoiceType(References.BLOCK_ENTITY).types().get("minecraft:decorated_pot");
17
		return Util.writeAndReadTypedOrThrow(entity, newType, contents -> {
18
			Dynamic<?> original = contents.get("sherds").orElseEmptyList();
19
			return contents.set("sherds", PotDecorationsComponentUnflatteningFix.unpackList(original));
20
		});
21
	}
22
}
23

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