Disable repair cost increment on rename

Effectively a backport of a 1.8 feature. Relevant because otherwise a renamed crate is nbt-incompatible with itself after being placed and broken
This commit is contained in:
abel1502 2025-06-02 21:34:48 +03:00
parent 4bc07d9cbf
commit 6fb0b647fd
No known key found for this signature in database
GPG Key ID: 076926596A536338

View File

@ -107,6 +107,7 @@ import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.player.AnvilRepairEvent;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@ -1248,6 +1249,15 @@ public class ModEventHandler {
}
}
@SubscribeEvent
public void onAnvilRepair(AnvilRepairEvent event) {
// Anvil renaming no longer increments the repair cost
if(event.left != null && event.right == null && event.output != null) {
event.output.setRepairCost(event.left.getRepairCost());
}
}
@SubscribeEvent
public void onClickSign(PlayerInteractEvent event) {