This is the API part of support for IExtensibleEnum, which actually implements doing awful things to enums. Most of them are implemented as simple accessors on both the enum's constructor and the $VALUES array (which is never actually called $VALUES because of proguard and intermediary.) The notable exceptions to this are SpawnRestriction.Location, which Forge adds additional functionality to (this required a companion interface and a mixin to SpawnHelper), and EnchantmentTarget, where we actually have to instantiate one of its anonymous inner classes, and @Coerce doesn't work for some reason, so we use MethodHandles. It also needed a companion interface to implement the Predicate-based functionality.
This is the API part of support for IExtensibleEnum, which actually implements doing awful things to enums. Most of them are implemented as simple accessors on both the enum's constructor and the $VALUES array (which is never actually called $VALUES because of proguard and intermediary.) The notable exceptions to this are SpawnRestriction.Location, which Forge adds additional functionality to (this required a companion interface and a mixin to SpawnHelper), and EnchantmentTarget, where we actually have to instantiate one of its anonymous inner classes, and
@Coerce
doesn't work for some reason, so we use MethodHandles. It also needed a companion interface to implement the Predicate-based functionality.