minecraft-src/net/minecraft/util/datafix/fixes/WeaponSmithChestLootTableFix.java
2025-07-04 01:41:11 +03:00

24 lines
797 B
Java

package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.Typed;
import com.mojang.datafixers.schemas.Schema;
public class WeaponSmithChestLootTableFix extends NamedEntityFix {
public WeaponSmithChestLootTableFix(Schema outputSchema, boolean changesType) {
super(outputSchema, changesType, "WeaponSmithChestLootTableFix", References.BLOCK_ENTITY, "minecraft:chest");
}
@Override
protected Typed<?> fix(Typed<?> typed) {
return typed.update(
DSL.remainderFinder(),
dynamic -> {
String string = dynamic.get("LootTable").asString("");
return string.equals("minecraft:chests/village_blacksmith")
? dynamic.set("LootTable", dynamic.createString("minecraft:chests/village/village_weaponsmith"))
: dynamic;
}
);
}
}