Swapping parts instead of AmmoItem repair (#30)

This commit is contained in:
Krepyn authored and GitHub committed 2026-05-18 20:37:55 +02:00
1 parent 2cf7f1bead
commit f28c84287f
2 files changed
+7 -3

No files matched your search

@@ -24,6 +24,7 @@ import tconstruct.library.modifier.ItemModifier;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.util.IToolPart;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
@@ -50,6 +51,9 @@ public class ModPartReplacement extends ItemModifier {
if (tags.getBoolean("Special")) return false;
if (tags.getInteger("Damage") > 0) return false;
// Durability is written on "Ammo" tag instead of "Damage" tag for AmmoWeapons
if (tool instanceof AmmoItem && ((AmmoItem) tool).getMaxAmmo(tags) != ((AmmoItem) tool).getAmmoCount(itemStack))
return false;
// check if any of the tools parts contain stone. we have to prevent exchanging that with disabled stone tools
// because otherwise the replacement-logic would not be able to obtain necessary information and crash.