MinecraftForge/MinecraftForge — pull request #1611 by thor12022 (2014-12-30 03:55:26+00:00)
Title: Allow an item to have some say in what enchants can be applied to it

Allows an easy way for an item to accept an enchant that it would be otherwise difficult to do.

This redirects the logic of Enchant::canApply(...) for items that implement IEnchantable, calling a method controlled by the Item to see if the enchant can be applied (IEnchantable::canApply(ItemStack, Enchantment).

I created a short [example](https://github.com/thor12022/SillyThings/tree/master/src/main/java/thor12022/sillythings) that uses an Item inheriting ItemAxe that can also accept enchants intended for ItemSword.

Where it falls short:
It does not allow for an equally common and easy way for an item to deny the application of an Enchant. What I mean is, due to the nature of overridden methods, child classes of Enchant can decided enchant applicability first. Like: EnchantmentDurability explicitly checks for items being damageable and returns true before IEnchantable::canApply(...) can get called. Meaning you can't disallow the application of the Unbreaking enchant using this method.