diff --git a/.gitignore b/.gitignore index bef75a1b..fdcab3ba 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ .*.swp /logs/ /*.pyc -/*mcp*/ +/mcp9*/ .idea/ *.iml releases/ diff --git a/applychanges.py b/applychanges.py index 337de6ed..d982275c 100644 --- a/applychanges.py +++ b/applychanges.py @@ -2,6 +2,7 @@ import shutil, fnmatch import subprocess, shlex from optparse import OptionParser +from minecriftversion import mc_version, minecrift_version_num, minecrift_build, of_file_extension, of_file_md5, mcp_version base_dir = os.path.dirname(os.path.abspath(__file__)) @@ -80,4 +81,4 @@ def applychanges(mcp_dir): elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): applychanges(os.path.abspath('..')) else: - applychanges(os.path.abspath('mcp908')) + applychanges(os.path.abspath(mcp_version)) diff --git a/build.py b/build.py index 8c4ad1dc..2108f88b 100644 --- a/build.py +++ b/build.py @@ -2,10 +2,11 @@ import shutil, tempfile,zipfile, fnmatch from optparse import OptionParser import subprocess, shlex - +from tempfile import mkstemp +from shutil import move +from os import remove, close from install import download_deps, download_native, download_file, mkdir_p - -mc_ver ="1.7.10" +from minecriftversion import mc_version, of_file_name, of_json_name, minecrift_version_num, minecrift_build, of_file_extension, of_file_md5, mcp_version, forge_version try: WindowsError @@ -45,13 +46,13 @@ def process_json( addon, version ): json_id = "minecrift-"+version+addon lib_id = "com.mtbs3d:minecrift:"+version time = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S-05:00") - with open(os.path.join("installer",mc_ver+addon+".json"),"rb") as f: + with open(os.path.join("installer",mc_version+addon+".json"),"rb") as f: json_obj = json.load(f) json_obj["id"] = json_id json_obj["time"] = time json_obj["releaseTime"] = time json_obj["libraries"].insert(0,{"name":lib_id}) #Insert at beginning - json_obj["libraries"].append({"name":"net.minecraft:Minecraft:"+mc_ver}) #Insert at end + json_obj["libraries"].append({"name":"net.minecraft:Minecraft:"+mc_version}) #Insert at end return json.dumps( json_obj, indent=1 ) def create_install(mcp_dir): @@ -78,20 +79,51 @@ def create_install(mcp_dir): elif os.getenv("BUILD_NUMBER"): version = "b"+os.getenv("BUILD_NUMBER") else: - version = "PRE4" + version = minecrift_build - version = mc_ver+"-"+version + version = minecrift_version_num+"-"+version + + # Replace version info in installer.java + print "Updating installer versions..." + installer_java_file = os.path.join("installer","Installer.java") + replacelineinfile( installer_java_file, "private static final String MINECRAFT_VERSION", " private static final String MINECRAFT_VERSION = \"%s\";\n" % mc_version ); + replacelineinfile( installer_java_file, "private static final String MC_VERSION", " private static final String MC_VERSION = \"%s\";\n" % minecrift_version_num ); + replacelineinfile( installer_java_file, "private static final String OF_FILE_NAME", " private static final String OF_FILE_NAME = \"%s\";\n" % of_file_name ); + replacelineinfile( installer_java_file, "private static final String OF_JSON_NAME", " private static final String OF_JSON_NAME = \"%s\";\n" % of_json_name ); + replacelineinfile( installer_java_file, "private static final String OF_MD5", " private static final String OF_MD5 = \"%s\";\n" % of_file_md5 ); + replacelineinfile( installer_java_file, "private static final String OF_VERSION_EXT", " private static final String OF_VERSION_EXT = \"%s\";\n" % of_file_extension ); + replacelineinfile( installer_java_file, "private static final String FORGE_VERSION", " private static final String FORGE_VERSION = \"%s\";\n" % forge_version ); + + # Build installer.java + print "Recompiling Installer.java..." + subprocess.Popen( + cmdsplit("javac \"%s\"" % os.path.join(base_dir,installer_java_file)), + cwd=os.path.join(base_dir,"installer"), + bufsize=-1).communicate() artifact_id = "minecrift-"+version installer_id = artifact_id+"-installer" installer = os.path.join( installer_id+".jar" ) shutil.copy( os.path.join("installer","installer.jar"), installer ) with zipfile.ZipFile( installer,'a', zipfile.ZIP_DEFLATED) as install_out: #append to installer.jar + + # Add newly compiled class files + for afile in os.listdir("installer"): + if os.path.isfile(os.path.join("installer",afile)) and afile.endswith('.class'): + print "Adding %s..." % afile + install_out.write(os.path.join("installer",afile), afile) + + # Add json files install_out.writestr( "version.json", process_json("", version)) install_out.writestr( "version-forge.json", process_json("-forge", version)) install_out.writestr( "version-nohydra.json", process_json("-nohydra", version)) install_out.writestr( "version-forge-nohydra.json", process_json("-forge-nohydra", version)) + + # Add version jar - this contains all the changed files (effectively minecrift.jar). A mix + # of obfuscated and non-obfuscated files. install_out.writestr( "version.jar", in_mem_zip.read() ) + + # Add the version info install_out.writestr( "version", artifact_id+":"+version ) print("Creating Installer exe...") @@ -106,12 +138,31 @@ def create_install(mcp_dir): bufsize=-1).communicate() os.unlink( "launch4j.xml" ) +def replacelineinfile(file_path, pattern, subst): + #Create temp file + fh, abs_path = mkstemp() + new_file = open(abs_path,'w') + old_file = open(file_path) + for line in old_file: + if pattern in line: + new_file.write(subst) + else: + new_file.write(line) + #close temp file + new_file.close() + close(fh) + old_file.close() + #Remove original file + remove(file_path) + #Move new file + move(abs_path, file_path) + def main(mcp_dir): print 'Using mcp dir: %s' % mcp_dir print 'Using base dir: %s' % base_dir print("Refreshing dependencies...") - download_deps( mcp_dir ) + download_deps( mcp_dir, False ) sys.path.append(mcp_dir) os.chdir(mcp_dir) @@ -144,4 +195,4 @@ def main(mcp_dir): elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): main(os.path.abspath('..')) else: - main(os.path.abspath('mcp908')) + main(os.path.abspath(mcp_version)) diff --git a/copybuildanddiffchangestopub.bat b/copybuildanddiffchangestopub.bat index 8eefba75..98821b58 100644 --- a/copybuildanddiffchangestopub.bat +++ b/copybuildanddiffchangestopub.bat @@ -1,8 +1,9 @@ SET MINECRIFT_SRCROOT=C:\minecrift-src SET MINECRIFTPUB_SRCROOT=C:\minecrift-public +SET MCP_VERSION=mcp910-pre1 -rmdir /S /Q %MINECRIFTPUB_SRCROOT%\mcp908\src\minecraft -xcopy /E %MINECRIFT_SRCROOT% %MINECRIFTPUB_SRCROOT%\mcp908\src\minecraft\ +rmdir /S /Q %MINECRIFTPUB_SRCROOT%\%MCP_VERSION%\src\minecraft +xcopy /E %MINECRIFT_SRCROOT% %MINECRIFTPUB_SRCROOT%\%MCP_VERSION%\src\minecraft\ cd %MINECRIFTPUB_SRCROOT% call build.bat call getchanges.bat diff --git a/create_install.py b/create_install.py index 65e5cef9..2c4173cd 100644 --- a/create_install.py +++ b/create_install.py @@ -1,3 +1,5 @@ #!/usr/bin/env python from build import create_install -create_install("mcp908") +from install import mcp_version + +create_install(mcp_version) diff --git a/getchanges.bat b/getchanges.bat index 7072c0ce..36e9eb6a 100644 --- a/getchanges.bat +++ b/getchanges.bat @@ -1,3 +1,2 @@ @echo off -REM.\mcp\runtime\bin\python\python_mcp getchanges.py python getchanges.py diff --git a/getchanges.py b/getchanges.py index fd1c8d19..38e54c1c 100644 --- a/getchanges.py +++ b/getchanges.py @@ -4,6 +4,8 @@ import shutil, glob, fnmatch import subprocess, logging, shlex, re from optparse import OptionParser +from minecriftversion import mcp_version, minecrift_version_num, minecrift_build +from build import replacelineinfile base_dir = os.path.dirname(os.path.abspath(__file__)) @@ -14,6 +16,7 @@ def cmdsplit(args): def create_patch( target_dir, src_file, mod_file, label, patch_file ): + print "Checking patch status for %s..." % src_file if os.name == 'nt': diff = os.path.abspath(os.path.join(base_dir, 'bin', 'diff.exe')) else: @@ -62,6 +65,11 @@ def main(mcp_dir): if mod_file[-4:]!="java": continue + if file_ == "Minecraft.java": + # Update Minecrift version + print "Updating Minecraft.java Minecrift version: [Minecrift %s %s] %s" % ( minecrift_version_num, minecrift_build, org_file ) + replacelineinfile( mod_file, "public final String minecriftVerString", " public final String minecriftVerString = \"Minecrift %s %s\";\n" % (minecrift_version_num, minecrift_build) ); + if os.path.exists(org_file): patch_file = os.path.join(patch_dir,file_+".patch") label = pkg.replace("\\","/") + "/" + file_ #patch label always has "/" @@ -85,4 +93,4 @@ def main(mcp_dir): elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): main(os.path.abspath('..')) else: - main(os.path.abspath('mcp908')) + main(os.path.abspath(mcp_version)) diff --git a/install.bat b/install.bat index c3f623f7..84eed607 100644 --- a/install.bat +++ b/install.bat @@ -1,5 +1,3 @@ @echo off +python install.py %* -REM.\mcp\runtime\bin\python\python_mcp install.py -python install.py -pause diff --git a/install.py b/install.py index dbeb3280..2151699d 100644 --- a/install.py +++ b/install.py @@ -3,24 +3,29 @@ import platform import shutil, tempfile, json import errno +import platform +from minecriftversion import mc_version, of_file_name, of_json_name, minecrift_version_num, minecrift_build, of_file_extension, of_file_md5, mcp_version, mc_file_md5 from hashlib import md5 # pylint: disable-msg=E0611 from optparse import OptionParser - from applychanges import applychanges, apply_patch base_dir = os.path.dirname(os.path.abspath(__file__)) -mc_version = "1.7.10" -of_version = mc_version+"_HD_U_A4" -of_file_extension = ".jar" -mcp_version = "mcp908" +preferredarch = '' +nomerge = False try: WindowsError except NameError: WindowsError = OSError +def osArch(): + if platform.machine().endswith('64'): + return '64' + else: + return '32' + def mkdir_p(path): try: os.makedirs(path) @@ -38,24 +43,41 @@ def get_md5(file): def download_file(url, target, md5=None): name = os.path.basename(target) - - if not os.path.isfile(target): + download = True + if not is_non_zero_file(target): + if os.path.isfile(target): + os.remove(target) + download = True + elif not md5 == None and not md5 == "": + if not get_md5(target) == md5: + print 'File Exists but bad MD5!: %s [MD5:%s]' % ( os.path.basename(target), get_md5(target) ) + os.remove(target) + download = True + else: + print 'File Exists: %s [MD5:%s]' % ( os.path.basename(target), get_md5(target) ) + download = False + else: + print 'File Exists: %s' % os.path.basename(target) + download = False + + if download is True: + print 'Downloading: %s' % os.path.basename(target) try: with open(target,"wb") as tf: res = urllib2.urlopen(urllib2.Request( url, headers = {"User-Agent":"Mozilla/5.0"})) tf.write( res.read() ) - if not md5 == None: + if not md5 == None and not md5 == "": if not get_md5(target) == md5: print 'Download of %s failed md5 check, deleting' % name os.remove(target) return False - print 'Downloaded %s' % name except Exception as e: print e print 'Download of %s failed, download it manually from \'%s\' to \'%s\'' % (target, url, target) + if os.path.isfile(target): + os.remove(target) return False - else: - print 'File Exists: %s' % os.path.basename(target) + return True def download_native(url, folder, name): @@ -68,21 +90,41 @@ def download_native(url, folder, name): return True -def download_deps( mcp_dir ): +def is_non_zero_file(fpath): + return True if os.path.isfile(fpath) and os.path.getsize(fpath) > 0 else False + +def download_deps( mcp_dir, download_mc ): + + mcp_exists = True if not os.path.exists(mcp_dir+"/runtime/commands.py "): - download_file( "http://mcp.ocean-labs.de/files/archive/"+mcp_version+".zip", mcp_version+".zip" ) + mcp_exists = False try: - os.mkdir( mcp_dir ) - mcp_zip = zipfile.ZipFile( mcp_version+".zip" ) - mcp_zip.extractall( mcp_dir ) - import stat - astyle = os.path.join(mcp_dir,"runtime","bin","astyle-osx") - st = os.stat( astyle ) - os.chmod(astyle, st.st_mode | stat.S_IEXEC) + mcp_zip_file = os.path.join( base_dir,mcp_version+".zip" ) + if os.path.exists( mcp_zip_file ): + os.mkdir( mcp_dir ) + mcp_zip = zipfile.ZipFile( mcp_zip_file ) + mcp_zip.extractall( mcp_dir ) + import stat + astyle = os.path.join(mcp_dir,"runtime","bin","astyle-osx") + st = os.stat( astyle ) + os.chmod(astyle, st.st_mode | stat.S_IEXEC) + mcp_exists = True except: pass - print("Patching mcp.cfg. ignore \"FAILED\" hunks") - apply_patch( mcp_dir, "mcp.cfg.patch", os.path.join(mcp_dir,"conf")) + + if mcp_exists == False: + print "No %s directory or zip file found. Please copy the %s.zip file into %s and re-run the command." % (mcp_dir, mcp_dir, base_dir) + exit(1) + + print("Patching mcp.cfg. Ignore \"FAILED\" hunks") + apply_patch( mcp_dir, os.path.join("mcppatches", "mcp.cfg.patch"), os.path.join(mcp_dir,"conf")) + + client_md5 = os.path.join("mcppatches","client.md5") + target_client_md5 = os.path.join(mcp_dir,"temp","client.md5") + if not os.path.exists(target_client_md5): + mkdir_p( os.path.join(mcp_dir,"temp") ) + print 'Updating client.md5: copying %s to %s' % (client_md5, target_client_md5) + shutil.copy(client_md5,target_client_md5) jars = os.path.join(mcp_dir,"jars") @@ -98,31 +140,76 @@ def download_deps( mcp_dir ): else: native = "windows" - + flat_lib_dir = os.path.join(base_dir,"lib",mc_version) + flat_native_dir = os.path.join(base_dir,"lib",mc_version,"natives",native) + mkdir_p( flat_lib_dir ) + mkdir_p( flat_native_dir ) + + # Get minecrift json file json_file = os.path.join(versions,mc_version+".json") - shutil.copy( os.path.join("installer",mc_version+".json"),json_file) - - optifine_dir = os.path.join(jars,"libraries","optifine","OptiFine",of_version ) - mkdir_p( optifine_dir ) - - optifine_url = "http://optifine.net/download.php?f=OptiFine_"+of_version+of_file_extension - print 'Downloading Optifine from: %s' % optifine_url - download_file( optifine_url, os.path.join( optifine_dir, "OptiFine-"+of_version+".jar" )) + source_json_file = os.path.join("installer",mc_version+".json") + print 'Updating json: copying %s to %s' % (source_json_file, json_file) + shutil.copy(source_json_file,json_file) + + # Use optifine json name for destination dir and jar names + optifine_dest_dir = os.path.join(jars,"libraries","optifine","OptiFine",of_json_name ) + mkdir_p( optifine_dest_dir ) + + print 'Checking Optifine...' + optifine_jar = "OptiFine-"+of_json_name+".jar" + optifine_dest_file = os.path.join( optifine_dest_dir, optifine_jar ) + + download_optifine = False + optifine_md5 = '' + if not is_non_zero_file( optifine_dest_file ): + download_optifine = True + else: + optifine_md5 = get_md5( optifine_dest_file ) + print 'Optifine md5: %s' % optifine_md5 + if optifine_md5 != of_file_md5: + download_optifine = True + print 'Bad MD5!' + else: + print 'MD5 good!' + + if download_optifine: + # Use optifine filename for URL + optifine_url = "http://optifine.net/download.php?f=OptiFine_"+of_file_name+of_file_extension + print 'Downloading Optifine...' + if not download_file( optifine_url, optifine_dest_file, of_file_md5 ): + print 'FAILED to download Optifine!' + sys.exit(1) + else: + shutil.copy(optifine_dest_file,os.path.join(flat_lib_dir, os.path.basename(optifine_dest_file))) + + if of_file_md5 == "": + optifine_md5 = get_md5( optifine_dest_file ) + print 'Optifine md5: %s' % optifine_md5 + sys.exit(0) json_obj = [] with open(json_file,"rb") as f: + #data=f.read() + #print 'JSON File:\n%s' % data json_obj = json.load( f ) try: newlibs = [] for lib in json_obj['libraries']: + libname = lib["name"] skip = False if "rules" in lib: for rule in lib["rules"]: if "action" in rule and rule["action"] == "allow" and "os" in rule: skip = True + for entry in rule["os"]: + if "name" in entry: + if rule["os"]["name"] == native: + skip = False if skip: + print 'File: %s\nSkipping due to rules' % libname continue + group,artifact,version = lib["name"].split(":") if "url" in lib: repo = lib["url"] @@ -141,49 +228,80 @@ def download_deps( mcp_dir ): file32 = os.path.join(jars,"libraries",url32.replace("/",os.sep)) mkdir_p(os.path.dirname(file32)) download_file( repo + url32, file32 ) + shutil.copy(file32,os.path.join(flat_lib_dir, os.path.basename(file32))) url64 = url.replace('${arch}', '64') file64 = os.path.join(jars,"libraries",url64.replace("/",os.sep)) mkdir_p(os.path.dirname(file64)) - download_file( repo + url64, file64 ) + download_file(repo + url64, file64) + shutil.copy(file64,os.path.join(flat_lib_dir, os.path.basename(file64))) + + # Use preferred architecture to choose which natives to extract. + if preferredarch is '32': + print ' Using preferred arch 32bit' + extractnatives( lib, jars, file32, flat_native_dir ) + else: + print ' Using preferred arch 64bit' + extractnatives( lib, jars, file64, flat_native_dir ) + else: file = os.path.join(jars,"libraries",url.replace("/",os.sep)) mkdir_p(os.path.dirname(file)) - download_file( repo + url, file ) - - if "natives" in lib: - folder = os.path.join(jars,"versions",mc_version,mc_version+"-natives") - mkdir_p(folder) - zip = zipfile.ZipFile(file) - for name in zip.namelist(): - if not name.startswith('META-INF') and not name.endswith('/'): - out_file = os.path.join(folder, name) - if not os.path.isfile(out_file): - print ' Extracting %s' % name - out = open(out_file, 'wb') - out.write(zip.read(name)) - out.flush() - out.close() - + if download_file( repo + url, file ) == True: + shutil.copy(file,os.path.join(flat_lib_dir, os.path.basename(file))) + extractnatives( lib, jars, file, flat_native_dir ) + newlibs.append( lib ) json_obj['libraries'] = newlibs with open(json_file,"wb+") as f: json.dump( json_obj,f, indent=1 ) - except: - pass - - repo = "https://s3.amazonaws.com/Minecraft.Download/" - jar_file = os.path.join(versions,mc_version+".jar") - jar_url = repo + "versions/"+mc_version+"/"+mc_version+".jar" - download_file( jar_url, jar_file ) - + except Exception as e: + print 'ERROR: %s' % e + raise + + if download_mc == True: + repo = "https://s3.amazonaws.com/Minecraft.Download/" + jar_file = os.path.join(versions,mc_version+".jar") + jar_url = repo + "versions/"+mc_version+"/"+mc_version+".jar" + download_file( jar_url, jar_file, mc_file_md5 ) + shutil.copy(jar_file,os.path.join(flat_lib_dir, os.path.basename(jar_file))) + + if mc_file_md5 == "": + mc_md5 = get_md5( jar_file ) + print '%s md5: %s' % ( os.path.basename(jar_file), mc_md5 ) + sys.exit(0) + +def extractnatives( lib, jars, file, copydestdir ): + if "natives" in lib: + folder = os.path.join(jars,"versions",mc_version,mc_version+"-natives") + mkdir_p(folder) + zip = zipfile.ZipFile(file) + #print 'Native extraction: folder: %s, file to unzip: %s' % (folder, file) + for name in zip.namelist(): + if not name.startswith('META-INF') and not name.endswith('/'): + out_file = os.path.join(folder, name) + print ' Extracting native library %s' % name + out = open(out_file, 'wb') + out.write(zip.read(name)) + out.flush() + out.close() + shutil.copy(out_file,os.path.join(copydestdir, os.path.basename(out_file))) def zipmerge( target_file, source_file ): out_file, out_filename = tempfile.mkstemp() out = zipfile.ZipFile(out_filename,'a') - target = zipfile.ZipFile( target_file, 'r') - source = zipfile.ZipFile( source_file, 'r' ) - + try: + target = zipfile.ZipFile( target_file, 'r') + except Exception as e: + print 'zipmerge: target not a zip-file: %s' % target_file + raise + + try: + source = zipfile.ZipFile( source_file, 'r' ) + except Exception as e: + print 'zipmerge: source not a zip-file: %s' % source_file + raise + #source supersedes target source_files = set( source.namelist() ) target_files = set( target.namelist() ) - source_files @@ -225,15 +343,23 @@ def osArch(): return '32' def main(mcp_dir): - print 'Using mcp dir: %s' % mcp_dir print 'Using base dir: %s' % base_dir - print("Downloading dependencies...") - download_deps( mcp_dir ) - - print("Applying Optifine...") - optifine = os.path.join(mcp_dir,"jars","libraries","optifine","OptiFine",of_version,"OptiFine-"+of_version+".jar" ) - zipmerge( os.path.join( mcp_dir,"jars","versions",mc_version,mc_version+".jar"), optifine ) - + print 'Using mcp dir: %s (use -m to change)' % mcp_dir + print 'Preferred architecture: %sbit - preferring %sbit native extraction (use -a 32 or -a 64 to change)' % (preferredarch, preferredarch) + if nomerge is True: + print 'NO Optifine merging' + print("\nDownloading dependencies...") + download_deps( mcp_dir, True ) + + if nomerge == False: + print("Applying Optifine...") + optifine = os.path.join(mcp_dir,"jars","libraries","optifine","OptiFine",of_json_name,"OptiFine-"+of_json_name+".jar" ) + minecraft_jar = os.path.join( mcp_dir,"jars","versions",mc_version,mc_version+".jar") + print ' Merging\n %s\n into\n %s' % (optifine, minecraft_jar) + zipmerge( minecraft_jar, optifine ) + else: + print("Skipping Optifine merge...") + print("Decompiling...") src_dir = os.path.join(mcp_dir, "src","minecraft") if os.path.exists( src_dir ): @@ -256,9 +382,22 @@ def main(mcp_dir): if __name__ == '__main__': parser = OptionParser() + parser.add_option('-o', '--no-optifine', dest='nomerge', default=False, action='store_true', help='If specified, no optifine merge will be carried out') parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to MCP to use', default=None) + parser.add_option('-a', '--architecture', action='store', dest='arch', help='Architecture to use (\'32\' or \'64\'); prefer 32 or 64bit dlls', default=None) options, _ = parser.parse_args() + if not options.arch is None: + if options.arch is '32': + preferredarch = '32' + elif options.arch is '64': + preferredarch = '64' + + if preferredarch is '': + preferredarch = osArch() + + nomerge = options.nomerge + if not options.mcp_dir is None: main(os.path.abspath(options.mcp_dir)) elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): diff --git a/installer/Installer.java b/installer/Installer.java index 16f55d4e..13672d64 100644 --- a/installer/Installer.java +++ b/installer/Installer.java @@ -37,14 +37,16 @@ public class Installer extends JPanel implements PropertyChangeListener { private static final long serialVersionUID = -562178983462626162L; - private static final String MC_VERSION = "1.7.10"; - - private static final String OF_LIB_PATH = "libraries/optifine/OptiFine/"; - private static final String OF_VERSION = "1.7.10_HD_U_A4"; - private static final String OF_MD5 = "FF3FD4C98E267D9D9EEB1296EDFBA5AA"; - private static final String OF_VERSION_EXT = "jar"; - - private static final String FORGE_VERSION = "10.13.0.1180"; + /* DO NOT RENAME THESE STRING CONSTS - THEY ARE USED IN (AND THE VALUES UPDATED BY) THE AUTOMATED BUILD SCRIPTS */ + private static final String MINECRAFT_VERSION = ""; + private static final String MC_VERSION = ""; + private static final String OF_LIB_PATH = "libraries/optifine/OptiFine/"; + private static final String OF_FILE_NAME = ""; + private static final String OF_JSON_NAME = ""; + private static final String OF_MD5 = ""; + private static final String OF_VERSION_EXT = ".jar"; + private static final String FORGE_VERSION = ""; + /* END OF DO NOT RENAME */ private InstallTask task; private static ProgressMonitor monitor; @@ -76,9 +78,9 @@ private boolean DownloadOptiFine() boolean deleted = false; try { - File fod = new File(targetDir,OF_LIB_PATH+OF_VERSION); + File fod = new File(targetDir,OF_LIB_PATH+OF_JSON_NAME); fod.mkdirs(); - File fo = new File(fod,"OptiFine-"+OF_VERSION+".jar"); + File fo = new File(fod,"OptiFine-"+OF_JSON_NAME+".jar"); // Attempt to get the Optifine MD5 String optOnDiskMd5 = GetMd5(fo); @@ -105,7 +107,7 @@ private boolean DownloadOptiFine() // Need to attempt download... FileOutputStream fos = new FileOutputStream(fo); try { - String surl = "http://optifine.net/download.php?f=OptiFine_" + OF_VERSION + "." + OF_VERSION_EXT; + String surl = "http://optifine.net/download.php?f=OptiFine_" + OF_FILE_NAME + "." + OF_VERSION_EXT; URL url = new URL(surl); ReadableByteChannel rbc = Channels.newChannel(url.openStream()); long bytes = fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); @@ -182,12 +184,12 @@ private String GetMd5(File fo) } private boolean SetupMinecraftAsLibrary() { - File lib_dir = new File(targetDir,"libraries/net/minecraft/Minecraft/"+MC_VERSION ); + File lib_dir = new File(targetDir,"libraries/net/minecraft/Minecraft/"+MINECRAFT_VERSION ); lib_dir.mkdirs(); - File lib_file = new File(lib_dir,"Minecraft-"+MC_VERSION+".jar"); + File lib_file = new File(lib_dir,"Minecraft-"+MINECRAFT_VERSION+".jar"); if( lib_file.exists() && lib_file.length() > 4500000 )return true; //TODO: should md5sum it here, I suppose try { - ZipInputStream input_jar = new ZipInputStream(new FileInputStream(new File(targetDir,"versions/"+MC_VERSION+"/"+MC_VERSION+".jar"))); + ZipInputStream input_jar = new ZipInputStream(new FileInputStream(new File(targetDir,"versions/"+MINECRAFT_VERSION+"/"+MINECRAFT_VERSION+".jar"))); ZipOutputStream lib_jar= new ZipOutputStream(new FileOutputStream(lib_file)); ZipEntry ze = null; @@ -370,7 +372,7 @@ public Void doInBackground() { } monitor.setProgress(50); monitor.setNote("Setting up Minecrift as a library..."); - finalMessage = "Failed: Couldn't setup Minecrift "+MC_VERSION+" as library. Have you run "+MC_VERSION+" at least once yet?"; + finalMessage = "Failed: Couldn't setup Minecrift "+MC_VERSION+" as library. Have you run "+MINECRAFT_VERSION+" at least once yet?"; sleep(800); if(!SetupMinecraftAsLibrary()) { @@ -400,7 +402,7 @@ public Void doInBackground() { } if (!downloadedOptifine) { finalMessage = "Installed (but failed to download OptiFine). Restart Minecraft and Edit Profile->Use Version minecrift-" + version + mod + - "\nPlease download and install Optifine " + OF_VERSION + "from https://optifine.net/downloads before attempting to play."; + "\nPlease download and install Optifine " + OF_FILE_NAME + "from https://optifine.net/downloads before attempting to play."; } else { finalMessage = "Installed Successfully! Restart Minecraft and Edit Profile->Use Version minecrift-" + version + mod; diff --git a/installer/installer.jar b/installer/installer.jar index 1a9123c5..da2a634c 100644 Binary files a/installer/installer.jar and b/installer/installer.jar differ diff --git a/mcp908/temp/client.md5 b/mcppatches/client.md5 similarity index 100% rename from mcp908/temp/client.md5 rename to mcppatches/client.md5 diff --git a/mcp.cfg.patch b/mcppatches/mcp.cfg.patch similarity index 100% rename from mcp.cfg.patch rename to mcppatches/mcp.cfg.patch diff --git a/minecriftversion.py b/minecriftversion.py new file mode 100644 index 00000000..47ac29aa --- /dev/null +++ b/minecriftversion.py @@ -0,0 +1,10 @@ +mc_version = "1.7.10" +mc_file_md5 = "" +of_file_name = "1.7.10_HD_U_A4" +of_json_name = "1.7.10_HD_U_A4" +of_file_md5 = "FF3FD4C98E267D9D9EEB1296EDFBA5AA" +minecrift_version_num = "1.7.10" +minecrift_build = "PRE5" +of_file_extension = ".jar" +mcp_version = "mcp908" +forge_version = "10.13.0.1180" \ No newline at end of file