Fix integrated server crash not stopping client (#4796)

This commit is contained in:
Ben Staddon 2018-03-13 23:29:12 +00:00 committed by LexManos
parent 752be6b526
commit 6ed2879842
2 changed files with 16 additions and 2 deletions

View file

@ -256,9 +256,12 @@
this.func_71403_a((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2346,6 +2381,12 @@
@@ -2344,8 +2379,14 @@
while (!this.field_71437_Z.func_71200_ad())
this.field_71461_s.func_73720_a(I18n.func_135052_a("menu.loadingLevel"));
- while (!this.field_71437_Z.func_71200_ad())
+ while (!this.field_71437_Z.func_71200_ad() && !this.field_71437_Z.func_71241_aa())
{
+ if (!net.minecraftforge.fml.common.StartupQuery.check())
+ {

View file

@ -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))