diff --git a/fml b/fml index 7fecf2ad6..902772ed0 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 7fecf2ad6bdd918149a3c43453f6a78bd11e5404 +Subproject commit 902772ed0cb6c22c4cd7ad9b0ec7a02961b5e016 diff --git a/install/install.py b/install/install.py index eecd55c7e..aac857fdc 100644 --- a/install/install.py +++ b/install/install.py @@ -4,30 +4,37 @@ import shutil, glob, fnmatch import subprocess, logging from optparse import OptionParser -forge_dir = os.path.dirname(os.path.abspath(__file__)) -fml_dir = os.path.join(forge_dir, 'fml') - -sys.path.append(fml_dir) -from forge import apply_forge_patches -from fml import setup_fml, finish_setup_fml, apply_fml_patches, setup_mcp, reset_logger - -def main(mcp_dir): - src_dir = os.path.join(mcp_dir, 'src') - +def fml_main(fml_dir, mcp_dir, gen_conf=True, disable_patches=False, disable_at=False, disable_merge=False, enable_server=False, + disable_client=False, disable_rename=False, disable_assets=False, decompile=False): + sys.path.append(fml_dir) + from fml import download_mcp, setup_mcp, decompile_minecraft, apply_fml_patches, finish_setup_fml print '================ Forge ModLoader Setup Start ===================' - setup_mcp(fml_dir, mcp_dir, True) - setup_fml(fml_dir, mcp_dir) - apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src')) - finish_setup_fml(fml_dir, mcp_dir) + download_mcp(fml_dir, mcp_dir) + setup_mcp(fml_dir, mcp_dir, gen_conf) + if decompile: + decompile_minecraft(fml_dir, mcp_dir, disable_at=disable_at, disable_merge=disable_merge, + enable_server=enable_server, disable_client=disable_client, + disable_assets=disable_assets) + if disable_patches: + print 'Patching disabled' + else: + apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src')) + finish_setup_fml(fml_dir, mcp_dir, enable_server=enable_server, disable_client=disable_client, disable_rename=disable_rename) + else: + print 'Decompile free install is on the to-do!' print '================ Forge ModLoader Setup End ===================' - - sys.path.append(mcp_dir) + +def forge_main(forge_dir, fml_dir, mcp_dir): + sys.path.append(mcp_dir) + sys.path.append(fml_dir) from runtime.updatenames import updatenames from runtime.updatemd5 import updatemd5 + from forge import apply_forge_patches + from fml import reset_logger print '=============================== Minecraft Forge Setup Start =====================================' print 'Applying forge patches' - apply_forge_patches(os.path.join(forge_dir, 'fml'), mcp_dir, forge_dir, src_dir, True) + apply_forge_patches(fml_dir, mcp_dir, forge_dir, os.path.join(mcp_dir, 'src'), True) os.chdir(mcp_dir) updatenames(None, True, True, False) reset_logger() @@ -35,15 +42,37 @@ def main(mcp_dir): reset_logger() os.chdir(forge_dir) print '=============================== Minecraft Forge Setup Finished =================================' - + if __name__ == '__main__': parser = OptionParser() - parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None) + parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None ) + parser.add_option('-p', '--no-patch', action="store_true", dest='no_patch', help='Disable application of FML patches', default=False) + parser.add_option('-a', '--no-access', action="store_true", dest='no_access', help='Disable access transformers', default=False) + parser.add_option('-s', '--server', action="store_true", dest='enable_server', help='Enable decompilation of server', default=False) + parser.add_option('-c', '--no-client', action="store_true", dest='no_client', help='Disable decompilation of server', default=False) + parser.add_option('-e', '--no-merge', action="store_true", dest='no_merge', help='Disable merging server code into client', default=False) + parser.add_option('-n', '--no-rename', action="store_true", dest='no_rename', help='Disable running updatenames', default=False) + parser.add_option( '--no-assets', action="store_true", dest='no_assets', help='Disable downloading of assets folder', default=False) + parser.add_option('-d', '--decompile', action="store_true", dest='decompile', help='Decompile minecraft and apply patches', default=True) options, _ = parser.parse_args() + + forge_dir = os.path.dirname(os.path.abspath(__file__)) + fml_dir = os.path.abspath('fml') + mcp_dir = os.path.abspath('mcp') if not options.mcp_dir is None: - main(os.path.abspath(options.mcp_dir)) - elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): - main(os.path.abspath('..')) - else: - main(os.path.abspath('mcp')) + mcp_dir = os.path.abspath(options.mcp_dir) + + if options.no_client: + options.no_patch = True + + if options.no_merge: + options.no_patch = True + + fml_main(fml_dir, mcp_dir, disable_patches=options.no_patch, + disable_at=options.no_access, disable_merge=options.no_merge, + enable_server=options.enable_server, disable_client=options.no_client, + disable_rename=options.no_rename, disable_assets=options.no_assets, + decompile=options.decompile, gen_conf=False) + + forge_main(forge_dir, fml_dir, mcp_dir) \ No newline at end of file