ForceCraft

ForceCraft

6M Downloads

[Bug]: Forcerod still breaks when set as unbreakable when used in transmutation crafting recipes

Dutchs opened this issue ยท 3 comments

commented

General Info

  • I am running a modpack
  • I can reproduce this issue consistently in single-player
  • I can reproduce this issue consistently in multi-player
  • I have searched for this issue previously and it was either (1) not previously reported, or (2) previously fixed and I am having the same problem.
  • I am crashing and can provide my crash report(s)
  • I am using the latest version of the mod

Forge version

47.3.0

Minecraft version

1.20.1

Mod version

4.2.3

Java version

17.0.0

Issue Description

We make items unbreakable by using datamancy, with the datamancy:unbreakable tag that turns the item into a non damageable item.
https://github.com/Darkhax-Minecraft/Datamancy/blob/1.20.1/common/src/main/java/net/darkhax/datamancy/common/mixin/item/MixinItemStack.java#L23-L28
The same thing can be achieved in vanilla (mc 1.20.1) using the command:

/give @s forcecraft:force_rod{Unbreakable:1b} 1

This appears to not work with the Forcerod, as it still takes damage and will eventually break when used in transmutation recipes, like turning diamond swords back into diamonds in the crafting grid.
I imagine this would need to be changed to take that into account:

int damage = rod.damageItem(itemstack1, 1);

In the vanilla codebase this check in done at ItemStack.hurtAndBreak by checking this.isDamageableItem() before calling ItemStack.damageItem

Additional Information

No response

commented

That damageItem is a custom method that handles using any applied force on the tool first before using durability, I never imagined someone making force tools unbreakable

commented

I'll add the isDamageableItem check inside the damageItem method used by the force tools

commented

I believe the Unbreakable NBT tag is relatively new in minecraft, possibly 1.20.x