Some tidyup of the PR

This commit is contained in:
cpw 2015-04-11 18:02:00 -04:00
parent 0055973f43
commit 4af2ba3949

View file

@ -91,9 +91,10 @@ public class FMLModContainer implements ModContainer
this.candidate = container; this.candidate = container;
this.descriptor = modDescriptor; this.descriptor = modDescriptor;
this.eventMethods = ArrayListMultimap.create(); this.eventMethods = ArrayListMultimap.create();
this.modLanguage = (String) modDescriptor.get("modLanguage"); this.modLanguage = (String) modDescriptor.get("modLanguage");
if (modDescriptor.get("modLanguageAdapter").equals("")) String languageAdapterType = (String)modDescriptor.get("modLanguageAdapter");
if (Strings.isNullOrEmpty(languageAdapterType))
{ {
this.languageAdapter = "scala".equals(modLanguage) ? new ILanguageAdapter.ScalaAdapter() : new ILanguageAdapter.JavaAdapter(); this.languageAdapter = "scala".equals(modLanguage) ? new ILanguageAdapter.ScalaAdapter() : new ILanguageAdapter.JavaAdapter();
} }
@ -101,13 +102,13 @@ public class FMLModContainer implements ModContainer
{ {
try try
{ {
this.languageAdapter = (ILanguageAdapter)Class.forName((String)modDescriptor.get("modLanguageAdapter"), true, Loader.instance().getModClassLoader()).newInstance(); this.languageAdapter = (ILanguageAdapter)Class.forName(languageAdapterType, true, Loader.instance().getModClassLoader()).newInstance();
FMLLog.finer("Using custom language adapter %s (for %s)", this.languageAdapter, this.className); FMLLog.finer("Using custom language adapter %s (type %s) for %s (modid %s)", this.languageAdapter, languageAdapterType, this.className, getModId());
} }
catch (Exception ex) catch (Exception ex)
{ {
FMLLog.severe("Error constructing custom mod language adapter %s (referenced by %s): %s", modDescriptor.get("modLanguageAdapter"), this.className, ex); FMLLog.log(Level.ERROR, ex, "Error constructing custom mod language adapter %s (referenced by %s) (modid: %s)", languageAdapterType, this.className, getModId());
FMLCommonHandler.instance().exitJava(1, true); throw new LoaderException(ex);
} }
} }
} }