Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Annotated Di Forge Wiki › Guides › Integrate Annotated DI with Other Mods

Integrate Annotated DI with Other Mods

Shared Dependency Injection Foundation

Annotated DI Mod works as a shared library for compatible mods. When multiple mods depend on it, they can share a common injection framework without each mod bundling its own version.

Using APIs from Other Mods

1. Check if a mod uses Annotated DI by looking for @ImplementedBy annotations on its public classes and interfaces.

2. Request instances from that mod's injector if it exposes one, or use the classes directly if they're already instantiated.

3. Avoid conflicts by keeping your mod's bindings separate. Each mod maintains its own injector, so there's no risk of one mod's configuration breaking another's.

Benefits

This approach means compatible mods can update their internal structure without breaking your code, since the injection layer abstracts away implementation details. You depend on interfaces, not concrete classes, making your mod more resilient to changes in dependencies.