Applicables
Applicables are the types of items to which the enchantment can be applied.
Creating an applicable
To start, create a class that implements the interface RegistrableApplicable
.
class MyApplicable : RegistrableApplicable {
override val aliases = listOf<String>()
override fun canBeAppliedTo(type: Material) = false
}
Fill the aliases list with however you want to identify your applicable.
Adding allowed items
The applicable checks whether an item can be legally enchanted by calling canBeAppliedTo
on its type. The implementation can be as simple as verifying the type against a list of allowed types:
Or, if necessary, you can do something more complicated/interesting, such as: