(No Fabric) Update the DependencyHandler to support circular references
This commit is contained in:
@@ -68,16 +68,22 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
|
||||
private void init(final FMLCommonSetupEvent event)
|
||||
{
|
||||
// make sure the dependencies are set up before the mod needs them
|
||||
LodCommonMain.initConfig();
|
||||
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
|
||||
ApiShared.LOGGER.info("Distant Horizons initializing...");
|
||||
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
|
||||
|
||||
|
||||
// make sure the dependencies are set up before the mod needs them
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
ForgeDependencySetup.finishBinding();
|
||||
|
||||
// mod dependencies
|
||||
if (ReflectionHandler.instance.optifinePresent()) {
|
||||
ModAccessorHandler.bind(IOptifineAccessor.class, new OptifineAccessor());
|
||||
}
|
||||
|
||||
ModAccessorHandler.finishBinding();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,21 +3,29 @@ package com.seibel.lod.forge.wrappers;
|
||||
import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;
|
||||
|
||||
/**
|
||||
* Binds all necessary dependencies, so we
|
||||
* Binds all necessary dependencies so we
|
||||
* can access them in Core. <br>
|
||||
* This needs to be called before any Core classes
|
||||
* are loaded.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author Ran
|
||||
* @version 12-1-2021
|
||||
* @version 3-5-2022
|
||||
*/
|
||||
public class ForgeDependencySetup
|
||||
{
|
||||
public static void createInitialBindings()
|
||||
{
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
|
||||
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
}
|
||||
|
||||
public static void finishBinding()
|
||||
{
|
||||
SingletonHandler.finishBinding();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user