This time for sure

This commit is contained in:
abel1502 2025-06-02 23:34:49 +03:00
parent 5fe26d5647
commit 997fb20129
No known key found for this signature in database
GPG Key ID: 076926596A536338

View File

@ -1256,7 +1256,17 @@ public class ModEventHandler {
// Anvil renaming no longer increments the repair cost
// Note: Forge has a bug, the names are wrong. Right is output, output is left, left is right
if(event.left == null && event.right != null && event.output != null) {
event.right.setRepairCost(event.output.getRepairCost());
int oldRepairCost = event.output.getRepairCost();
if (oldRepairCost > 0) {
event.right.setRepairCost(oldRepairCost);
} else if (event.right.hasTagCompound()) {
NBTTagCompound nbt = event.right.getTagCompound();
nbt.removeTag("RepairCost");
if (nbt.hasNoTags()) {
event.right.setTagCompound(null);
}
}
}
}