Optional Integrations
Myotus uses annotation markers plus a runtime integration manager to keep optional compatibility code organized.
Built-in registrations
Section titled “Built-in registrations”The constructor bootstrap in Myotus.java registers these integration markers in both inspected lines:
| Marker annotation | Mod ID |
|---|---|
JEI | jei |
EMI | emi |
REI | roughlyenoughitems |
AE2WTLib | ae2wtlib |
AE2FCT | ae2fct |
AE2TB | ae2tb |
GuideME-related addon code is also present in the repository, but it is not part of that exact registration list in Myotus.java.
Registration flow
Section titled “Registration flow”- Declare a marker annotation for an optional dependency.
- Register that marker against a mod ID.
- Use the runtime integration manager to decide whether to activate integration-specific behavior.
On 1.21.1, the bootstrap uses fluent aliases directly on MyotusAPI.modRegistrar():
MyotusAPI.modRegistrar() .registerLoadableMod(JEI.class, "jei") .registerLoadableMod(AE2WTLib.class, "ae2wtlib");Example
Section titled “Example”MyotusAPI.modRegistrar() .registerLoadableMod(MyMarker.class, "examplemod", "[2.0.0,)");
if (MyotusAPI.modIntegrationManager().isLoaded(MyMarker.class)) { // Apply optional integration code.}Runtime inspection
Section titled “Runtime inspection”IModIntegrationManager exposes:
isLoaded(Class<? extends Annotation>)isLoaded(String modId)isRegistered(String modId)getAnnotationClass(String modId)getActiveIntegrations()
Use it whenever integration-specific classes or mixins must be gated by loader state.
Related helpers
Section titled “Related helpers”SafeClasswraps reflective class resolution so optional integrations can fail soft when a class is missing.ItemListModLoadHelperuses the same integration registry to gate JEI, EMI, and REI subscriber dispatch.MyoModConditionreuses the registered mod IDs at the NeoForge data-condition layer. See Datagen Conditions.