Tetra

Tetra

23M Downloads

Tools with Mana Repair and Unbreaking don't repair the last durability point[Bug]

MahMeer opened this issue · 8 comments

commented

Observed behaviour

image
Tools with both manarepair and unbreaking don't repair their last point of durability. additionally if you hold the mana-ring/tablet in your hand you'll notice that the tool is still consuming mana but not repairing.

Expected behaviour

The tool repairs to full durability and stops consuming mana.

Steps to reproduce

  1. Place a pickaxe in a workbench
  2. Replace both pickaxe heads with manasteel
  3. Enchant one of the heads with an unbreaking enchanted book (any unbreaking level works)
  4. have a full mana-ring/tablet in your inventory
  5. break a few blocks until there is a green bar underneath the tool indicating it is damaged.
  6. (optional) hold the mana-ring/tablet in you hand and observe it updating

Crashlog

No Crash

Tetra version

tetra-1.19.2-5.5.1

mutil/mGui version

mutil-1.19.2-5.1.0

Forge version

1.19.2-43.3.2

Other mods

Botania
Patchouli
Curios API (Forge)
mutil

commented

further testing revealed that wearing manasteel armor from botania with unbreaking causes the same effect even with unenchanted tools.

commented

Isn't that an issue in botania then?

commented

i have done a bit more testing and its not the unbreaking on the armor that causes it but the set bonus of 10% mana discount to mana tools. i suspect the unbreaking enchantment also reduces the mana cost rather than the vanilla behavior.
since botania has its own manasteel tools which don't have this bug i suspect its a rounding error somewhere in the code that handels the manacost of the tetra tools. i don't know which mod handels which aspects of this calculation however so you might be correct that its an issue with botania.

commented

if it is as you suspect, an issue with botania, please inform me so i can report the issue there.

commented

Encountering this bug myself playing Valhelsia 5.
Using terrasteel armor set.
A terrasteel greatsword without unbreaking doesn't repair last point of durability until i break the set bonus (unequip 1 armor piece).
A terrasteel pickadze with unbreaking never fully repairs, even after breaking set bonus.
Botania tools doesn't seem to have any issue (but I don't have one with unbreaking on hand).

commented

Encountering this bug as well on a custom modpack.
Using all 4 pieces of manasteel OR terrasteel armor set.
Using any equipment created by tetra with the mana repair enchantment on one or more modules.
Tetra tools consume mana but do not repair while botania tools consume mana and repair as expected.
Removing any one piece of the armor (breaking set bonus) causes tetra tools to consume mana and repair as expected.

I don't think this is a botania issue...

commented

Same here on Minecraft 1.20.1, Forge 47.2.0, Tetra 6.1.0, and Tetracelium 1.0.1 with Botania 1.20.1-441-FORGE. Any tetra tool with manasteel as major modules does not repair with mana at all. Enchanted or unenchanted, armor or no armor. Also the Botania mana bar doesn't show when using a manasteel tetra tool, unlike other mana-consuming items from Botania. Though, Botania just barely updated to 1.20.1 recently.

2023-12-13_01 11 53

commented

For what it's worth, Botania's own tools have two ways they use mana in relation to durability.

  • Whenever the tool would take durability damage, it attempts to consume mana, 60 points per durability point hit. On success it doesn't take the damage in the first place.
  • If the tool is already damaged, it will attempt to consume 120 mana (i.e. double the above amount) each tick to repair one durability point.

In both cases, Botania uses ManaItemHandler.instance().requestManaExactForTool with boolean return value, which applies possible discounts and returns whether the discounted amount of mana was successfully extracted.
Now I don't know what Tetra does here, but if it instead uses the requestManaForTool method, that would also apply the discount and return how much mana was actually extracted. However, that value would be lower than the requested amount, due to the discount. Comparing that to the originally requested amount would obviously fail in the presence of mana discounting armor (all Botania sets have between 10% and 40% discount), the unbreaking enchantment on the tool (adds 5% per level on top of the armor discount), or any 3rd-party mana discounts.