Fix English injection for some mods on dedicated server.
This commit is contained in:
parent
6ae39ac027
commit
7c9b67b574
1 changed files with 14 additions and 3 deletions
|
@ -231,7 +231,8 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
@Override
|
||||
public void addModAsResource(ModContainer container)
|
||||
{
|
||||
String langFile = "assets/" + container.getModId().toLowerCase() + "/lang/en_US.lang";
|
||||
String langFile = "assets/" + container.getModId().toLowerCase() + "/lang/en_us.lang";
|
||||
String langFile2 = "assets/" + container.getModId().toLowerCase() + "/lang/en_US.lang";
|
||||
File source = container.getSource();
|
||||
InputStream stream = null;
|
||||
ZipFile zip = null;
|
||||
|
@ -239,17 +240,27 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
{
|
||||
if (source.isDirectory() && (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"))
|
||||
{
|
||||
stream = new FileInputStream(new File(source.toURI().resolve(langFile).getPath()));
|
||||
File f = new File(source.toURI().resolve(langFile).getPath());
|
||||
if (!f.exists())
|
||||
f = new File(source.toURI().resolve(langFile2).getPath());
|
||||
if (!f.exists())
|
||||
throw new FileNotFoundException(source.toURI().resolve(langFile).getPath());
|
||||
stream = new FileInputStream(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
zip = new ZipFile(source);
|
||||
ZipEntry entry = zip.getEntry(langFile);
|
||||
if(entry == null) throw new FileNotFoundException();
|
||||
if (entry == null) entry = zip.getEntry(langFile2);
|
||||
if (entry == null) throw new FileNotFoundException(langFile);
|
||||
stream = zip.getInputStream(entry);
|
||||
}
|
||||
LanguageMap.inject(stream);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
FMLLog.getLogger().warn("Missing English translation for " + container.getModId() + ": " + e.getMessage());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// hush
|
||||
|
|
Loading…
Reference in a new issue