Fix NPE with CoreMods who do not have the new MCVersion annotation.

This commit is contained in:
LexManos 2013-03-19 13:48:18 -07:00
parent b8f72c678b
commit 11d5ac1e07

View file

@ -408,7 +408,15 @@ public class RelaunchLibraryManager
classLoader.addTransformerExclusion(fmlCorePlugin); classLoader.addTransformerExclusion(fmlCorePlugin);
Class<?> coreModClass = Class.forName(fmlCorePlugin, true, classLoader); Class<?> coreModClass = Class.forName(fmlCorePlugin, true, classLoader);
MCVersion requiredMCVersion = coreModClass.getAnnotation(IFMLLoadingPlugin.MCVersion.class); MCVersion requiredMCVersion = coreModClass.getAnnotation(IFMLLoadingPlugin.MCVersion.class);
String version = requiredMCVersion.value(); String version = "";
if (requiredMCVersion == null)
{
FMLRelaunchLog.log(Level.WARNING, "The coremod %s does not have a MCVersion annotation, it may cause issues with this version of Minecraft", fmlCorePlugin);
}
else
{
version = requiredMCVersion.value();
}
if (!"".equals(version) && !FMLInjectionData.mccversion.equals(version)) if (!"".equals(version) && !FMLInjectionData.mccversion.equals(version))
{ {
FMLRelaunchLog.log(Level.SEVERE, "The coremod %s is requesting minecraft version %s and minecraft is %s. It will be ignored.", fmlCorePlugin, version, FMLInjectionData.mccversion); FMLRelaunchLog.log(Level.SEVERE, "The coremod %s is requesting minecraft version %s and minecraft is %s. It will be ignored.", fmlCorePlugin, version, FMLInjectionData.mccversion);