-
Notifications
You must be signed in to change notification settings - Fork 0
Enums
This page covers the Enums module of Dark Matter.
ExtendableEnum is an interface implemented on enums which can be extended using this module.
As of 3.0.0 Dark Matter patches:
- RecipeBookCategory
- Rarity
- Formatting
- BoatEntity.Type
- AbstractMinecartEntity.Type
- RecipeBookGroup
- EnchantmentTarget
- Raid.Member
Tip
It's better to use Recipe Book to extend RecipeBookCategory and RecipeBookGroup.
EnumWrapper provides proper constructor types and checks for enums. For example, instead of calling:
EnchantmentTarget.values()[0].dark_matter$extend("ENUM_NAME", new Object[]{((Predicate<Item>) item -> isAllowed(item))});You can call:
EnumWrapper.EnchantmentTarget.extend("ENUM_NAME", item -> isAllowed(item))Note
This terrible hack may be fixed once either this PR is merged, or this issue is resolved.
EnumUtils contains experimental and "should probably be in impl" utils.
This is an experimental method, which attempts to extend enums using reflection, handles and Unsafe. Stability of this method is questionable.
Those methods are not useful, unless you're trying to transform enums yourself.
Dark Matter wiki by constellation-mc is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
