Renamed Main to ForgeMain and added some config ui comment stuff

This commit is contained in:
coolGi
2022-06-03 17:13:28 +09:30
parent 32a5880c17
commit 8bfe624f97
10 changed files with 13 additions and 41 deletions
@@ -30,6 +30,8 @@ import com.seibel.lod.core.handlers.ReflectionHandler;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.IVersionConstants;
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.config.LodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
@@ -46,6 +48,8 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
public class DependencySetup {
public static void createInitialBindings()
{
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE); // TODO: Remove
SingletonHandler.bind(IConfigWrapper.class, ConfigWrapper.INSTANCE);
SingletonHandler.bind(IVersionConstants.class, VersionConstants.INSTANCE);
if (!SharedApi.inDedicatedEnvironment)
@@ -51,7 +51,7 @@ import java.lang.invoke.MethodHandles;
* @author Ran
* @version 12-1-2021
*/
public class Main implements ClientModInitializer, DedicatedServerModInitializer
public class FabricMain implements ClientModInitializer, DedicatedServerModInitializer
{
// This is a client mod so it should implement ClientModInitializer and in fabric.mod.json it should have "environment": "client"
// Once it works on servers change the implement to ModInitializer and in fabric.mod.json it should be "environment": "*"
@@ -68,7 +68,7 @@ public class Main implements ClientModInitializer, DedicatedServerModInitializer
public void onInitializeClient() {
SharedApi.inDedicatedEnvironment = false;
init();
ClientLifecycleEvents.CLIENT_STARTED.register(Main::postInit);
ClientLifecycleEvents.CLIENT_STARTED.register(FabricMain::postInit);
}
@Override
@@ -94,6 +94,7 @@ public class Main implements ClientModInitializer, DedicatedServerModInitializer
FabricDependencySetup.finishBinding();
LodCommonMain.initConfig();
LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
if (!SharedApi.inDedicatedEnvironment) {
client_proxy = new FabricClientProxy();
client_proxy.registerEvents();
@@ -111,6 +112,6 @@ public class Main implements ClientModInitializer, DedicatedServerModInitializer
ModAccessorHandler.bind(IOptifineAccessor.class, new OptifineAccessor());
}
ModAccessorHandler.finishBinding();
LOGGER.info("Mod Initialized");
LOGGER.info(ModInfo.READABLE_NAME + " Initialized");
}
}
@@ -19,12 +19,8 @@
package com.seibel.lod.fabric.mixins;
import com.seibel.lod.fabric.Main;
import net.minecraft.server.dedicated.DedicatedServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(DedicatedServer.class)
@Deprecated // Please use the OnServerLoadEvent in core instead, or
@@ -19,13 +19,8 @@
package com.seibel.lod.fabric.mixins;
import com.seibel.lod.fabric.Main;
import net.minecraft.client.Minecraft;
import net.minecraft.client.main.GameConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* Loads the mod after minecraft loads.
@@ -22,27 +22,15 @@ package com.seibel.lod.fabric.mixins.client;
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
import com.seibel.lod.common.wrappers.world.WorldWrapper;
import com.seibel.lod.core.api.internal.a7.ClientApi;
import com.seibel.lod.core.api.internal.a7.SharedApi;
import com.seibel.lod.core.config.Config;
import com.seibel.lod.fabric.Main;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.renderer.LevelRenderer;
#if POST_MC_1_18_2
import net.minecraft.core.Holder;
#endif
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.function.Supplier;
/**
* This class is used for world loading events
* @author Ran
@@ -19,16 +19,10 @@
package com.seibel.lod.fabric.mixins.events;
import com.seibel.lod.fabric.Main;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* If someone has a better way to do this then please let me know.
@@ -19,13 +19,8 @@
package com.seibel.lod.fabric.mixins.events;
import com.seibel.lod.fabric.Main;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.ProgressListener;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* This class is used for world saving events
@@ -40,8 +40,6 @@ public class FabricDependencySetup
public static void createInitialBindings()
{
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
}
public static void finishBinding() {
+2 -2
View File
@@ -19,10 +19,10 @@
"environment": "*",
"entrypoints": {
"client": [
"com.seibel.lod.fabric.Main"
"com.seibel.lod.fabric.FabricMain"
],
"server": [
"com.seibel.lod.fabric.Main"
"com.seibel.lod.fabric.FabricMain"
],
"modmenu": [
@@ -79,11 +79,12 @@ public class ForgeMain implements LodForgeMethodCaller
private void init(final FMLCommonSetupEvent event)
{
// make sure the dependencies are set up before the mod needs them
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
// LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
LodCommonMain.startup(this);
ForgeDependencySetup.createInitialBindings();
ForgeDependencySetup.finishBinding();
LodCommonMain.initConfig();
LOGGER.info("Distant Horizons initializing...");
LOGGER.info(ModInfo.READABLE_NAME + " initializing...");
}
public ForgeMain()