diff --git a/.gitignore b/.gitignore index b88e1838c8..b00de09d8c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ fmlbranding.properties /fernflower.zip /commands.py.bck +/mcp*.zip +/mcp diff --git a/build.xml b/build.xml index 27e81071f6..4a9da7cf2c 100644 --- a/build.xml +++ b/build.xml @@ -46,9 +46,13 @@ - + + + + + @@ -77,6 +81,13 @@ + + + + + + + @@ -212,6 +223,7 @@ + @@ -272,12 +284,8 @@ Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML-Server and FML-Client projects - - - - - - + + @@ -285,11 +293,7 @@ - - - - - + diff --git a/install/fml.py b/install/fml.py index e302467dea..af096ba0e1 100644 --- a/install/fml.py +++ b/install/fml.py @@ -95,8 +95,7 @@ def download_minecraft(mcp_dir, fml_dir, version=None): default = config_get_section(config, 'default') if version is None: - version = default['current_ver'] - + version = default['current_ver'] bin_folder = os.path.join(mcp_dir, 'jars', 'bin') if not os.path.exists(bin_folder): @@ -615,9 +614,54 @@ def merge_tree(root_src_dir, root_dst_dir): if os.path.exists(dst_file): os.remove(dst_file) shutil.copy(src_file, dst_dir) - + +def download_mcp(mcp_dir, fml_dir, version=None): + if os.path.isfile(os.path.join(mcp_dir, 'runtime', 'commands.py')): + print 'MCP Detected already, not downloading' + return True + + if os.path.isdir(mcp_dir): + print 'Old MCP Directory exists, but MCP was not detected, please delete MCP directory at \'%s\'' % mcp_dir + sys.exit(1) + + versions_file = os.path.join(fml_dir, 'mc_versions.cfg') + if not os.path.isfile(versions_file): + print 'Could not find mc_versions.cfg in FML directory.' + sys.exit(1) + + config = ConfigParser.ConfigParser() + config.read(versions_file) + + default = config_get_section(config, 'default') + if version is None: + version = default['current_ver'] + + if not config.has_section(version): + print 'Error: Invalid minecraft version, could not find \'%s\' in mc_versions.cfg' % version + sys.exit(1) + + mc_info = config_get_section(config, version) + mcp_zip = os.path.join(fml_dir, 'mcp%s.zip' % mc_info['mcp_ver']) + + if not download_file(mc_info['mcp_url'], mcp_zip, mc_info['mcp_md5']): + sys.exit(1) + + if not os.path.isdir(mcp_dir): + _mkdir(mcp_dir) + + print 'Extracting MCP to \'%s\'' % mcp_dir + zf = ZipFile(mcp_zip) + zf.extractall(mcp_dir) + zf.close() + + return True + def setup_mcp(fml_dir, mcp_dir, dont_gen_conf=True): global mcp_version + + if not download_mcp(mcp_dir, fml_dir): + sys.exit(1) + backup = os.path.join(mcp_dir, 'runtime', 'commands.py.bck') runtime = os.path.join(mcp_dir, 'runtime', 'commands.py') patch = os.path.join(fml_dir, 'commands.patch') diff --git a/install/install.bat b/install/install.bat index 44f6646436..4698e2b229 100644 --- a/install/install.bat +++ b/install/install.bat @@ -1,4 +1,4 @@ echo off -@set PATH=%PATH%;%SystemDir%\system32;%SystemRoot%\System32;..\runtime\bin\python -python_mcp install.py +@set PATH=%PATH%;%SystemDir%\system32;%SystemRoot%\System32;.\python\ +python_fml install.py pause diff --git a/install/install.py b/install/install.py index 3705ebd5b2..bb22a593cc 100644 --- a/install/install.py +++ b/install/install.py @@ -1,4 +1,5 @@ import os, os.path, sys +from optparse import OptionParser from fml import setup_fml, finish_setup_fml, apply_fml_patches, setup_mcp @@ -11,4 +12,15 @@ def fml_main(fml_dir, mcp_dir, dont_gen_conf=True): print '================ Forge ModLoader Setup End ===================' if __name__ == '__main__': - fml_main(os.path.dirname(os.path.abspath(__file__)), os.path.abspath('..')) \ No newline at end of file + parser = OptionParser() + parser.add_option('-m', '--mcp-dir', action='store_true', dest='mcp_dir', help='Path to download/extract MCP to', default=None) + options, _ = parser.parse_args() + + fml_dir = os.path.dirname(os.path.abspath(__file__)) + + if not options.mcp_dir is None: + fml_main(fml_dir, os.path.abspath(options.mcp_dir)) + if not os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): + fml_main(fml_dir, os.path.abspath('..')) + else: + fml_main(fml_dir, os.path.abspath('mcp')) \ No newline at end of file diff --git a/mc_versions.cfg b/mc_versions.cfg index b369c6278e..8d7c736e2d 100644 --- a/mc_versions.cfg +++ b/mc_versions.cfg @@ -10,6 +10,8 @@ server_url = http://assets.minecraft.net/1_4_4/minecraft_server.jar client_md5 = 7aa46c8058cba2f38e9d2ddddcc77c72 server_md5 = b5feed15df1db87c9aaf78dcefad513d mcp_ver = 7.21 +mcp_url = https://www.dropbox.com/s/dao8itysfwuhj9q/mcp721.zip?dl=1 +mcp_md5 = 772ecfdac7e4c9491bfb131cee3bbb36 [1.4.5] client_url = http://assets.minecraft.net/1_4_5/minecraft.jar @@ -17,3 +19,5 @@ server_url = http://assets.minecraft.net/1_4_5/minecraft_server.jar client_md5 = b15e2b2b6b4629f0d99a95b6b44412a0 server_md5 = 250654ceae7a26ba955a30095d90a475 mcp_ver = 7.23 +mcp_url = https://www.dropbox.com/s/w5vc4kfkge7jti2/mcp723.zip?dl=1 +mcp_md5 = 9fbb5835b437b64bc5ce618fa5a53d1d