Harvest MC version from MCP
This commit is contained in:
parent
b51ce21b70
commit
a8f599983e
3 changed files with 28 additions and 9 deletions
|
@ -26,6 +26,7 @@
|
|||
<target name="writeversion" depends="buildenvsetup">
|
||||
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
|
||||
<arg value="${basedir}/getversion.py" />
|
||||
<arg value="${mcp.home}"/>
|
||||
</exec>
|
||||
<propertyfile file="fmlversion.properties">
|
||||
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
|
||||
|
|
|
@ -92,7 +92,8 @@ public class Loader
|
|||
private static String minor;
|
||||
private static String rev;
|
||||
private static String build;
|
||||
private static String mcversion;
|
||||
private static String mccversion;
|
||||
private static String mcsversion;
|
||||
|
||||
/**
|
||||
* The {@link State} of the loader
|
||||
|
@ -163,18 +164,19 @@ public class Loader
|
|||
if (stream != null) {
|
||||
try {
|
||||
properties.load(stream);
|
||||
major = properties.getProperty("fmlbuild.major.number","none");
|
||||
minor = properties.getProperty("fmlbuild.minor.number","none");
|
||||
rev = properties.getProperty("fmlbuild.revision.number","none");
|
||||
build = properties.getProperty("fmlbuild.build.number","none");
|
||||
mcversion = properties.getProperty("fmlbuild.mcversion","none");
|
||||
major = properties.getProperty("fmlbuild.major.number","none");
|
||||
minor = properties.getProperty("fmlbuild.minor.number","none");
|
||||
rev = properties.getProperty("fmlbuild.revision.number","none");
|
||||
build = properties.getProperty("fmlbuild.build.number","none");
|
||||
mccversion = properties.getProperty("fmlbuild.mcclientversion","none");
|
||||
mcsversion = properties.getProperty("fmlbuild.mcserverversion","none");
|
||||
} catch (IOException ex) {
|
||||
Loader.log.log(Level.SEVERE,"Could not get FML version information - corrupted installation detected!", ex);
|
||||
throw new LoaderException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
log.info(String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s loading", major, minor, rev, build, mcversion));
|
||||
log.info(String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft c:%s, s:%s loading", major, minor, rev, build, mccversion, mcsversion));
|
||||
modClassLoader = new ModClassLoader();
|
||||
}
|
||||
|
||||
|
@ -646,7 +648,7 @@ public class Loader
|
|||
public String getCrashInformation()
|
||||
{
|
||||
StringBuffer ret = new StringBuffer();
|
||||
for (String brand : FMLCommonHandler.instance().getBrandingStrings(String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s", major, minor, rev, build, mcversion))) {
|
||||
for (String brand : FMLCommonHandler.instance().getBrandingStrings(String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s", major, minor, rev, build, mccversion))) {
|
||||
ret.append(brand).append("\n");
|
||||
}
|
||||
for (ModContainer mod : mods)
|
||||
|
|
|
@ -5,6 +5,15 @@ import fnmatch
|
|||
import re
|
||||
import subprocess, shlex
|
||||
|
||||
mcp_home = sys.argv[1]
|
||||
mcp_dir = os.path.abspath(mcp_home)
|
||||
|
||||
print(mcp_dir)
|
||||
sys.path.append(mcp_dir)
|
||||
|
||||
from runtime.commands import Commands
|
||||
Commands._version_config = os.path.join(mcp_dir,Commands._version_config)
|
||||
|
||||
def cmdsplit(args):
|
||||
if os.sep == '\\':
|
||||
args = args.replace('\\', '\\\\')
|
||||
|
@ -35,12 +44,19 @@ def main():
|
|||
print("Git not found")
|
||||
vers="v1.0-0-deadbeef"
|
||||
(major,minor,rev,githash)=re.match("v(\d+).(\d+)-(\d+)-(.*)",vers).groups()
|
||||
|
||||
(mcpversion,mcclientversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()
|
||||
|
||||
with open("fmlversion.properties","w") as f:
|
||||
f.write("%s=%s\n" %("fmlbuild.major.number",major))
|
||||
f.write("%s=%s\n" %("fmlbuild.minor.number",minor))
|
||||
f.write("%s=%s\n" %("fmlbuild.revision.number",rev))
|
||||
f.write("%s=%s\n" %("fmlbuild.githash",githash))
|
||||
f.write("%s=%s\n" %("fmlbuild.mcversion","12w24a"))
|
||||
f.write("%s=%s\n" %("fmlbuild.mcpversion",mcpversion))
|
||||
f.write("%s=%s\n" %("fmlbuild.mcclientversion",mcclientversion))
|
||||
f.write("%s=%s\n" %("fmlbuild.mcserverversion",mcserverversion))
|
||||
|
||||
print("Version information: FML %s.%s.%s using MCP %s for c:%s, s:%s" % (major, minor, rev, mcpversion, mcclientversion, mcserverversion))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue