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(); 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() public void handleServerStopped()
{ {
sidedDelegate.serverStopped();
MinecraftServer server = getMinecraftServerInstance(); MinecraftServer server = getMinecraftServerInstance();
Loader.instance().serverStopped(); Loader.instance().serverStopped();
// FORCE the internal server to stop: hello optifine workaround! // 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() public String getModName()
@ -499,7 +500,7 @@ public class FMLCommonHandler
public String getCurrentLanguage() public String getCurrentLanguage()
{ {
return sidedDelegate.getCurrentLanguage(); return sidedDelegate.getCurrentLanguage();
} }
} }

View File

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

View File

@ -207,7 +207,7 @@ public class FMLServerHandler implements IFMLSidedHandler
public void addModAsResource(ModContainer container) public void addModAsResource(ModContainer container)
{ {
File source = container.getSource(); File source = container.getSource();
try try
{ {
if (source.isDirectory()) if (source.isDirectory())
{ {
@ -218,9 +218,9 @@ public class FMLServerHandler implements IFMLSidedHandler
searchZipForENUSLanguage(source); searchZipForENUSLanguage(source);
} }
} }
catch (IOException ioe) catch (IOException ioe)
{ {
} }
} }
private static final Pattern assetENUSLang = Pattern.compile("assets/(.*)/lang/en_US.lang"); private static final Pattern assetENUSLang = Pattern.compile("assets/(.*)/lang/en_US.lang");
@ -258,11 +258,17 @@ public class FMLServerHandler implements IFMLSidedHandler
@Override @Override
public void updateResourcePackList() public void updateResourcePackList()
{ {
} }
@Override @Override
public String getCurrentLanguage() public String getCurrentLanguage()
{ {
return "en_US"; return "en_US";
} }
@Override
public void serverStopped()
{
// NOOP
}
} }