Skip to content

Advanced Usage

The_Fireplace edited this page May 30, 2022 · 3 revisions

In some cases, it may be necessary to access the Injector directly, whether for your mod or another. To do so, you can call Injectors.INSTANCE.getAutoInjector(modid) to access to the Injector for the given mod.

To set up a custom Injector where you declare which mods' injections to include, use Injectors.INSTANCE.getCustomInjector(modid1, modid2,...).

For more advanced configuration of injections, you can create a custom module. See Guice's documentation for more information on Modules.

On Fabric, you can use the di-module entrypoint with a class implementing DIModuleCreator to register it.

On Forge, before you initialize your Injector, call CustomModuleRegistry.INSTANCE.register() with a collection of custom modules passed as a parameter.

Clone this wiki locally