Some changes to stop server from crashing on startup
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.seibel.distanthorizons.common.LodCommonMain;
|
||||
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -20,6 +21,7 @@ public class FabricClientMain implements ClientModInitializer
|
||||
{
|
||||
DependencySetup.createClientBindings();
|
||||
FabricMain.init();
|
||||
LodCommonMain.initConfig();
|
||||
|
||||
server_proxy = new FabricServerProxy(false);
|
||||
server_proxy.registerEvents();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.seibel.distanthorizons.common.LodCommonMain;
|
||||
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftDedicatedServerWrapper;
|
||||
import com.seibel.distanthorizons.core.config.eventHandlers.presets.ThreadPresetConfigEventHandler;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -24,6 +26,11 @@ public class FabricDedicatedServerMain implements DedicatedServerModInitializer
|
||||
DependencySetup.createServerBindings();
|
||||
FabricMain.init();
|
||||
|
||||
// FIXME this prevents returning uninitialized Config values
|
||||
// resulting from a circular reference mid-initialization in a static class
|
||||
// ThreadPresetConfigEventHandler <-> Config
|
||||
ThreadPresetConfigEventHandler.INSTANCE.toString();
|
||||
|
||||
server_proxy = new FabricServerProxy(true);
|
||||
server_proxy.registerEvents();
|
||||
|
||||
@@ -31,8 +38,11 @@ public class FabricDedicatedServerMain implements DedicatedServerModInitializer
|
||||
if (hasPostSetupDone) return;
|
||||
hasPostSetupDone = true;
|
||||
LodUtil.assertTrue(server instanceof DedicatedServer);
|
||||
|
||||
MinecraftDedicatedServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer) server;
|
||||
LodCommonMain.initConfig();
|
||||
FabricMain.postInit();
|
||||
|
||||
LOGGER.info("Dedicated server inited at {}", server.getServerDirectory());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent;
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent;
|
||||
import com.seibel.distanthorizons.core.config.ConfigBase;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||
import com.seibel.distanthorizons.common.LodCommonMain;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
@@ -55,6 +56,9 @@ public class FabricMain
|
||||
if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib"))
|
||||
ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog
|
||||
|
||||
if (ConfigBase.INSTANCE == null)
|
||||
throw new IllegalStateException("Config was not initialized. Make sure to call LodCommonMain.initConfig() before calling this method.");
|
||||
|
||||
LOGGER.info("Mod Post-Initialized");
|
||||
}
|
||||
|
||||
@@ -89,9 +93,5 @@ public class FabricMain
|
||||
LOGGER.info(ModInfo.READABLE_NAME + " Initialized");
|
||||
|
||||
ApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterDhInitEvent.class, null);
|
||||
|
||||
// Init config
|
||||
// The reason im initialising in this rather than the post init process is cus im using this for the auto updater
|
||||
LodCommonMain.initConfig();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user