Support simple mc version test in coremods, only effective through
jar loading. Also, log some more data about the environment.
This commit is contained in:
parent
ed17b11a76
commit
b8f72c678b
|
@ -163,6 +163,9 @@ public class FMLRelauncher
|
||||||
FMLRelaunchLog.minecraftHome = minecraftHome;
|
FMLRelaunchLog.minecraftHome = minecraftHome;
|
||||||
FMLRelaunchLog.info("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s loading", FMLInjectionData.major, FMLInjectionData.minor,
|
FMLRelaunchLog.info("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s loading", FMLInjectionData.major, FMLInjectionData.minor,
|
||||||
FMLInjectionData.rev, FMLInjectionData.build, FMLInjectionData.mccversion, FMLInjectionData.mcpversion);
|
FMLInjectionData.rev, FMLInjectionData.build, FMLInjectionData.mccversion, FMLInjectionData.mcpversion);
|
||||||
|
FMLRelaunchLog.info("Java is %s, version %s, running on %s:%s:%s, installed at %s", System.getProperty("java.vm.name"), System.getProperty("java.version"), System.getProperty("os.name"), System.getProperty("os.arch"), System.getProperty("os.version"), System.getProperty("java.home"));
|
||||||
|
FMLRelaunchLog.fine("Java classpath at launch is %s", System.getProperty("java.class.path"));
|
||||||
|
FMLRelaunchLog.fine("Java library path at launch is %s", System.getProperty("java.library.path"));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,4 +87,18 @@ public interface IFMLLoadingPlugin
|
||||||
{
|
{
|
||||||
public String[] value() default "";
|
public String[] value() default "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to target a specific minecraft version for your coremod. It will refuse to load with an error if
|
||||||
|
* minecraft is not this exact version.
|
||||||
|
*
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface MCVersion
|
||||||
|
{
|
||||||
|
public String value() default "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import java.util.jar.JarFile;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import cpw.mods.fml.common.CertificateHelper;
|
import cpw.mods.fml.common.CertificateHelper;
|
||||||
|
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
|
||||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
|
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
|
||||||
|
|
||||||
public class RelaunchLibraryManager
|
public class RelaunchLibraryManager
|
||||||
|
@ -406,6 +407,17 @@ public class RelaunchLibraryManager
|
||||||
downloadMonitor.updateProgressString("Loading coremod %s", coreMod.getName());
|
downloadMonitor.updateProgressString("Loading coremod %s", coreMod.getName());
|
||||||
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);
|
||||||
|
String version = requiredMCVersion.value();
|
||||||
|
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);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (!"".equals(version))
|
||||||
|
{
|
||||||
|
FMLRelaunchLog.log(Level.FINE, "The coremod %s requested minecraft version %s and minecraft is %s. It will be loaded.", fmlCorePlugin, version, FMLInjectionData.mccversion);
|
||||||
|
}
|
||||||
TransformerExclusions trExclusions = coreModClass.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class);
|
TransformerExclusions trExclusions = coreModClass.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class);
|
||||||
if (trExclusions!=null)
|
if (trExclusions!=null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue