Botania

Botania

133M Downloads

Terra Truncator and Terra Shatterer still drain durability-restoring mana when enchanted with indestructible(Forbidden & Arcanus)

Tiln1 opened this issue ยท 4 comments

commented

Version Information

Forge version: 36.0.15
Botania version: 1.16.4-411

Further Information

commented

This issue is stale because it has been open for a while with no activity. Remove stale label or comment or this will be closed soon.

commented

This is happening because Forbidden and Arcanus prevent damage by using a mixin on ItemStack#attemptDamageItem:
https://github.com/stal111/Forbidden-Arcanus/blob/722e34d4a1f3bb77ca1243ea330b00bb851d5eee/src/main/java/com/stal111/forbidden_arcanus/mixin/ItemStackMixin.java#L20-L25

But if you look at the implementation for ItemStack#damageItem:

if (this.isDamageable()) {
    amount = this.getItem().damageItem(this, amount, entityIn, onBroken);
    if (this.attemptDamageItem(amount, ...)) {
        ...

It first calls IForgeItem#damageItem to get the amount of damage that the item should take, then it calls ItemStack#attemptDamageItem to apply things like unbreaking, then it actually damages the item.
Botania redirects damage to mana by overriding IForgeItem#damageItem.

I suppose there are multiple ways to fix this:

  • Forbidden Arcanus could Mixin to ItemStack#damageItem instead or in addition to ItemStack#attemptDamageItem.
  • Forbidden Arcanus could alternatively just mixin ItemStack#isDamageable, but idk if that has unwanted side effects. It'd be effectively the same as an item stack having the "Unbreakable" NBT tag set though.
  • Botania could override IForgeItem#setDamage to drain mana there instead (this feels kinda hacky though and it'd break if a mod had a good reason to setDamage). Actually no reference to player so this doesn't work.
  • Botania could, instead of draining mana immediately, instantly repair the durability damage the tool has taken when the item is ticked. (IIRC this is how Blood Magic armour worked in 1.7.10). This does have the edge case of the tool being fully damaged and broken in a single tick though, but that's probably not likely to happen.

Also, changing Botania like that would make unbreaking work to reduce mana drain which I'm not sure if that is desired. Also Mana tools currently repair 1 durability per tick using up more mana per durability if they happen to take direct durability damage vs if mana was used directly to prevent the damage. Not sure how you'd disinguish the two situations.

IMO, fixing it on Forbidden Arcanus' end is better in this case to be more compatible with other mods too.

commented

Unbreaking doesn't have an effect on this by default either, we added a mana discount on top of this because of that, actually.

commented

So the last option could be an acceptable change then? (option 3 doesn't work oops). It does have the edge case of a tool being damaged from full in a single tick but not sure if that can happen easily. It'd also make the tools repair instantly instead of 1 durability per tick if they are used without mana not sure if that is okay?

Still think a change on Forbidden Arcanus' would be good for mod compatibility with other mods though.