Fix integrated server crash not stopping client (#4796)

This commit is contained in:
Ben Staddon authored and LexManos committed 2018-03-13 16:29:12 -07:00
1 parent 752be6b526
commit 6ed2879842
2 files changed
+16 -2

No files matched your search

@@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod(modid = "clientexceptiontest", version = "1.0", name = "Client Exception Test", clientSideOnly = true)
@@ -20,6 +21,7 @@ public class ClientExceptionTestMod
public static boolean ENABLE_PREINIT = false;
public static boolean ENABLE_INIT = false;
public static boolean ENABLE_LOAD_COMPLETE = false;
public static boolean ENABLE_SERVER_STARTED = false;
@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent e)
@@ -55,6 +57,15 @@ public class ClientExceptionTestMod
}
}
@Mod.EventHandler
public void onServerStarted(FMLServerStartedEvent e)
{
if (ENABLE_SERVER_STARTED)
{
throw new RuntimeException("Server thread exception - should stop client");
}
}
private void throwException(String runtimeMessage)
{
throw new CustomModLoadingErrorDisplayException("Custom Test Exception", new RuntimeException(runtimeMessage))