Start porting duplicate code to common

This commit is contained in:
Ran
2021-12-01 11:45:03 +06:00
parent 012312892a
commit 1decb3764f
31 changed files with 3187 additions and 19 deletions
@@ -100,7 +100,9 @@ public class ClientProxy
/** This is also called when a new dimension loads */
public void worldLoadEvent(Level level)
{
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(level));
if (level != null) {
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(level));
}
}
public void worldUnloadEvent()
@@ -19,6 +19,7 @@
package com.seibel.lod.fabric;
import com.seibel.lod.common.LodCommonMain;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.fabric.wrappers.DependencySetup;
@@ -35,7 +36,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
*
* @author coolGi2007
* @author Ran
* @version 11-21-2021
* @version 12-1-2021
*/
public class Main implements ClientModInitializer
{
@@ -58,6 +59,7 @@ public class Main implements ClientModInitializer
// This loads the mod after minecraft loads which doesn't causes a lot of issues
public static void init() {
LodCommonMain.startup(null);
DependencySetup.createInitialBindings();
ClientApi.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
@@ -20,18 +20,13 @@ import com.seibel.lod.fabric.wrappers.minecraft.MinecraftWrapper;
* are loaded.
*
* @author James Seibel
* @version 11-20-2021
* @author Ran
* @version 12-1-2021
*/
public class DependencySetup
{
public static void createInitialBindings()
{
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
SingletonHandler.bind(IBlockColorSingletonWrapper.class, BlockColorSingletonWrapper.INSTANCE);
SingletonHandler.bind(IMinecraftWrapper.class, MinecraftWrapper.INSTANCE);
SingletonHandler.bind(IMinecraftRenderWrapper.class, MinecraftRenderWrapper.INSTANCE);
SingletonHandler.bind(IWrapperFactory.class, WrapperFactory.INSTANCE);
SingletonHandler.bind(IReflectionHandler.class, ReflectionHandler.createSingleton(MinecraftWrapper.INSTANCE.getOptions().getClass().getDeclaredFields(), MinecraftWrapper.INSTANCE.getOptions()));
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);;
}
}