Fix up a deep crash in the early server init hanging the client

This commit is contained in:
Christian 2013-09-20 17:02:56 -04:00
parent 74b7cba492
commit da0972980b
4 changed files with 25 additions and 6 deletions

View file

@ -612,4 +612,14 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return client.func_135016_M().func_135041_c().func_135034_a();
}
@Override
public void serverStopped()
{
// If the server crashes during startup, it might hang the client- reset the client so it can abend properly.
if (!getServer().func_71200_ad())
{
ObfuscationReflectionHelper.setPrivateValue(MinecraftServer.class, getServer(), true, "field_71296"+"_Q","serverIs"+"Running");
}
}
}

View file

@ -465,10 +465,11 @@ public class FMLCommonHandler
public void handleServerStopped()
{
sidedDelegate.serverStopped();
MinecraftServer server = getMinecraftServerInstance();
Loader.instance().serverStopped();
// FORCE the internal server to stop: hello optifine workaround!
if (server!=null) ObfuscationReflectionHelper.setPrivateValue(MinecraftServer.class, server, false, "field_71316_v", "u", "serverStopped");
if (server!=null) ObfuscationReflectionHelper.setPrivateValue(MinecraftServer.class, server, false, "field_71316"+"_v", "u", "serverStopped");
}
public String getModName()

View file

@ -68,4 +68,6 @@ public interface IFMLSidedHandler
void updateResourcePackList();
String getCurrentLanguage();
void serverStopped();
}

View file

@ -265,4 +265,10 @@ public class FMLServerHandler implements IFMLSidedHandler
{
return "en_US";
}
@Override
public void serverStopped()
{
// NOOP
}
}