WeaponSmithChestLootTableFix .java

net.minecraft.util.datafix.fixes.WeaponSmithChestLootTableFix (class): extends NamedEntityFix. members: fix. strings: "LootTable", "minecraft:chest".

net.minecraft.util.datafix.fixesclass25 linescommonextends NamedEntityFix803 B

API Surface (1)

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

String literals (4)

"minecraft:chest"
"LootTable"
"minecraft:chests/village_blacksmith"
"minecraft:chests/village/village_weaponsmith"

Code Graph: Dependencies (1)

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

Full Source

WeaponSmithChestLootTableFix.java25 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.DSL;
4
import com.mojang.datafixers.Typed;
5
import com.mojang.datafixers.schemas.Schema;
6
7
public class WeaponSmithChestLootTableFix extends NamedEntityFix {
8
	public WeaponSmithChestLootTableFix(final Schema outputSchema, final boolean changesType) {
9
		super(outputSchema, changesType, "WeaponSmithChestLootTableFix", References.BLOCK_ENTITY, "minecraft:chest");
10
	}
11
12
	@Override
13
	protected Typed<?> fix(final Typed<?> entity) {
14
		return entity.update(
15
			DSL.remainderFinder(),
16
			tag -> {
17
				String lootTable = tag.get("LootTable").asString("");
18
				return lootTable.equals("minecraft:chests/village_blacksmith")
19
					? tag.set("LootTable", tag.createString("minecraft:chests/village/village_weaponsmith"))
20
					: tag;
21
			}
22
		);
23
	}
24
}
25

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