Disenchanter (The Disenchanter Mod)

Disenchanter (The Disenchanter Mod)

21M Downloads

Embers clockwork tools are destroyed when removing enchantments with the Disenchanter mod

jonqrandom opened this issue ยท 1 comments

commented

i also added the Redstone Arsenal mod, and tested some unbreakable tools and armour from that - they don't get destroyed (or consume stored RF) during disenchanting. this occurs even with all Disenchanter's damage options set to 0, and unfortunately, no messages appear in the log.
i'm testing with the current releases of all mods, and latest Forge (2760).

i've also reported the issue on their tracker.

commented

This is an issue on their end and it seems that they resolved it.
The disenchanting-table attempts to deal damage to the item, even if that damage is 0. If an "unbreakable" tool breaks from this damage then its "unbreakability" is wrongly implemented, since this damage would occur through normal usage too.
The right way to make an item unbreakable is to use the official methods to turn it unbreakable. (aka. give it the Unbreakable:1 NBT-Tag)
I have not looked into the Embers' source too far, but the solution of overriding isDamageable() may not solve the issue. If you look into the RedstoneArsenal's source, they leave it on true. Also isDamageable() is used to check if an item is enchantable (in Item.java):

public boolean isEnchantable(ItemStack stack)
    {
        return this.getItemStackLimit(stack) == 1 && this.isDamageable();
    }

Specifically the disenchanting-table uses attemptDamageItem from ItemStack.java. That uses isItemStackDamageable() internally which checks for either the Unbreakable Tag (I'd say this is the prefered way!) or if the item's max durability is lower than 1 (the method RedstoneArsenal uses):

public boolean isItemStackDamageable()
    {
        if (this.isEmpty)
        {
            return false;
        }
        else if (this.item.getMaxDamage(this) <= 0)
        {
            return false;
        }
        else
        {
            return !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable");
        }
    }

I'm writing this down so the Ember's developers can look this information up if the issue persists.