def main(): print '=================================== Minecraft Forge Setup Start =================================' if os.path.isdir(os.path.join(mcp_dir, 'conf')): shutil.rmtree(os.path.join(mcp_dir, 'conf')) copytree(os.path.join(forge_dir, 'conf'), os.path.join(mcp_dir, 'conf')) if os.path.isdir(src_dir): os.chdir(mcp_dir) cleanup(None, False) reset_logger() os.chdir(forge_dir) if os.path.isdir(src_dir): print 'Please make sure to backup your modified files, and say yes when it asks you to do cleanup.' sys.exit(1) if not download_ff(mcp_dir): sys.exit(1) try: pre_decompile() os.chdir(mcp_dir) # Conf JAD CSV -r -d -a -n -p -o -l -g decompile(None, False, False, True, True, False, True, False, False, False, False) reset_logger() os.chdir(forge_dir) post_decompile() except SystemExit, e: print 'Decompile Exception: %d ' % e.code raise e
def build(build_num=0): version = load_version(build_num) print '=================================== Build %d.%d.%d.%d Start =================================' % (version['major'], version['minor'], version['revision'], version['build']) if os.path.isdir(src_dir): shutil.rmtree(src_dir) inject_version(os.path.join(forge_dir, 'forge_common', 'net', 'minecraft', 'src', 'forge', 'ForgeHooks.java'), build_num) print 'src_work -> src' copytree(os.path.join(mcp_dir, 'src_work'), src_dir) print '\nforge_client -> minecraft' copytree(os.path.join(forge_dir, 'forge_client', 'src'), os.path.join(src_dir, 'minecraft'), -1) print '\nforge_server -> minecraft_server' copytree(os.path.join(forge_dir, 'forge_server', 'src'), os.path.join(src_dir, 'minecraft_server'), -1) print '\nforge_common -> minecraft' copytree(os.path.join(forge_dir, 'forge_common'), os.path.join(src_dir, 'minecraft'), -1) print '\nforge_common -> minecraft_server' copytree(os.path.join(forge_dir, 'forge_common'), os.path.join(src_dir, 'minecraft_server'), -1) print error_level = 0 try: os.chdir(mcp_dir) reset_logger() recompile(None) reset_logger() os.chdir(forge_dir) except SystemExit, e: print 'Recompile Exception: %d ' % e.code error_level = e.code
def build(build_num=0): version = load_version(build_num) print '=================================== Build %d.%d.%d.%d Start =================================' % ( version['major'], version['minor'], version['revision'], version['build']) if os.path.isdir(src_dir): shutil.rmtree(src_dir) inject_version( os.path.join(forge_dir, 'forge_common', 'net', 'minecraft', 'src', 'forge', 'ForgeHooks.java'), build_num) print 'src_work -> src' copytree(os.path.join(mcp_dir, 'src_work'), src_dir) print '\nforge_client -> minecraft' copytree(os.path.join(forge_dir, 'forge_client', 'src'), os.path.join(src_dir, 'minecraft'), -1) print '\nforge_server -> minecraft_server' copytree(os.path.join(forge_dir, 'forge_server', 'src'), os.path.join(src_dir, 'minecraft_server'), -1) print '\nforge_common -> minecraft' copytree(os.path.join(forge_dir, 'forge_common'), os.path.join(src_dir, 'minecraft'), -1) print '\nforge_common -> minecraft_server' copytree(os.path.join(forge_dir, 'forge_common'), os.path.join(src_dir, 'minecraft_server'), -1) print error_level = 0 try: os.chdir(mcp_dir) reset_logger() recompile(None) reset_logger() os.chdir(forge_dir) except SystemExit, e: print 'Recompile Exception: %d ' % e.code error_level = e.code
def setup_fml(): print 'Setting up Forge ModLoader' fml = glob.glob(os.path.join(forge_dir, 'fml-src-*.zip')) if not len(fml) == 1: if len(fml) == 0: print 'Missing FML source zip, should be named fml-src-*.zip inside your forge folder, obtain it from the repo' else: print 'To many FML source zips found, we should only have one. Check the Forge Git for the latest FML version supported' sys.exit(1) fml_dir = os.path.join(forge_dir, 'fml') if os.path.isdir(fml_dir): shutil.rmtree(fml_dir) print 'Extracting: %s' % os.path.basename(fml[0]) zf = zipfile.ZipFile(fml[0]) zf.extractall(forge_dir) zf.close() print 'Applying Forge ModLoader patches' apply_patches(os.path.join(fml_dir, 'patches'), src_dir) copytree(os.path.join(fml_dir, 'src'), src_dir)
if not os.path.isdir(src_dir): print 'Something went wrong, src folder not found at: %s' % src_dir sys.exit(1) cleanup_source(src_dir) has_client = os.path.isdir(os.path.join(mcp_dir, 'src', 'minecraft')) has_server = os.path.isdir(os.path.join(mcp_dir, 'src', 'minecraft_server')) fml_dir = os.path.join(forge_dir, 'fml') print 'Applying Forge ModLoader patches' if has_client: if os.path.isdir(os.path.join(fml_dir, 'patches', 'minecraft')): apply_patches(os.path.join(fml_dir, 'patches', 'minecraft'), src_dir) if os.path.isdir(os.path.join(fml_dir, 'src', 'minecraft')): copytree(os.path.join(fml_dir, 'src', 'minecraft'), os.path.join(src_dir, 'minecraft')) if has_server: if os.path.isdir(os.path.join(fml_dir, 'patches', 'minecraft_server')): apply_patches(os.path.join(fml_dir, 'patches', 'minecraft_server'), src_dir) if os.path.isdir(os.path.join(fml_dir, 'src', 'minecraft_server')): copytree(os.path.join(fml_dir, 'src', 'minecraft_server'), os.path.join(src_dir, 'minecraft_server')) os.chdir(mcp_dir) updatenames(None, True) reset_logger() os.chdir(forge_dir) print 'Applying forge patches' if has_client: if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')): apply_patches(os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
sys.exit(1) cleanup_source(src_dir) has_client = os.path.isdir(os.path.join(mcp_dir, 'src', 'minecraft')) has_server = os.path.isdir(os.path.join(mcp_dir, 'src', 'minecraft_server')) fml_dir = os.path.join(forge_dir, 'fml') print 'Applying Forge ModLoader patches' if has_client: if os.path.isdir(os.path.join(fml_dir, 'patches', 'minecraft')): apply_patches(os.path.join(fml_dir, 'patches', 'minecraft'), src_dir) if os.path.isdir(os.path.join(fml_dir, 'src', 'minecraft')): copytree(os.path.join(fml_dir, 'src', 'minecraft'), os.path.join(src_dir, 'minecraft')) if has_server: if os.path.isdir(os.path.join(fml_dir, 'patches', 'minecraft_server')): apply_patches(os.path.join(fml_dir, 'patches', 'minecraft_server'), src_dir) if os.path.isdir(os.path.join(fml_dir, 'src', 'minecraft_server')): copytree(os.path.join(fml_dir, 'src', 'minecraft_server'), os.path.join(src_dir, 'minecraft_server')) os.chdir(mcp_dir) updatenames(None, True) reset_logger() os.chdir(forge_dir) print 'Applying forge patches' if has_client: