Skip to content
This repository was archived by the owner on Apr 22, 2019. It is now read-only.
This repository was archived by the owner on Apr 22, 2019. It is now read-only.

EMC values for enchantments #940

@BigXplosion

Description

@BigXplosion

I'm wondering if it is possible to take the enchantments into account for the tools? Best way to do this is probably calculating an extra EMC value on top of the original one with the use of the enchantment weight and level. Maybe something like this:

public int getAdditionEnchantmentEMC(ItemStack stack) {
        int result = 0;

        Map<Integer, Integer> enchantments = EnchantmentHelper.getEnchantments(stack);

        if (!enchantments.isEmpty())
        {
            for (Map.Entry<Integer, Integer> entry : enchantments.entrySet())
            {
                Enchantment enchantment = Enchantment.enchantmentsList[entry.getKey()];

                if (enchantment.getWeight() == 0)
                {
                    continue;
                }

                result += 5000 / enchantment.getWeight() * entry.getValue();
            }
        }

        return result;
}

If this would be added I would say to not make the enchanted item learnable (if this isn't already the case)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions