2012-08-01 23:35:35 +00:00
|
|
|
import os, os.path, sys
|
|
|
|
import urllib, zipfile
|
|
|
|
import shutil, glob, fnmatch
|
|
|
|
import subprocess, logging
|
2012-12-10 02:58:01 +00:00
|
|
|
from optparse import OptionParser
|
2012-08-01 23:35:35 +00:00
|
|
|
|
|
|
|
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
2012-08-10 01:37:52 +00:00
|
|
|
fml_dir = os.path.join(forge_dir, 'fml')
|
2012-08-01 23:35:35 +00:00
|
|
|
|
2012-08-10 01:37:52 +00:00
|
|
|
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
|
2012-08-01 23:35:35 +00:00
|
|
|
|
2012-12-10 02:58:01 +00:00
|
|
|
def main(mcp_dir):
|
|
|
|
src_dir = os.path.join(mcp_dir, 'src')
|
|
|
|
|
2012-08-10 01:37:52 +00:00
|
|
|
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)
|
|
|
|
print '================ Forge ModLoader Setup End ==================='
|
2012-08-12 21:32:01 +00:00
|
|
|
|
|
|
|
sys.path.append(mcp_dir)
|
|
|
|
from runtime.updatenames import updatenames
|
|
|
|
from runtime.updatemd5 import updatemd5
|
2012-08-10 01:37:52 +00:00
|
|
|
|
|
|
|
print '=============================== Minecraft Forge Setup Start ====================================='
|
2012-08-01 23:35:35 +00:00
|
|
|
print 'Applying forge patches'
|
2012-08-10 01:48:20 +00:00
|
|
|
apply_forge_patches(os.path.join(forge_dir, 'fml'), mcp_dir, forge_dir, src_dir, True)
|
2012-08-01 23:35:35 +00:00
|
|
|
os.chdir(mcp_dir)
|
2012-10-22 01:20:02 +00:00
|
|
|
updatenames(None, True, True, False)
|
2012-08-01 23:35:35 +00:00
|
|
|
reset_logger()
|
2012-10-22 01:20:02 +00:00
|
|
|
updatemd5(None, True, True, False)
|
2012-08-01 23:35:35 +00:00
|
|
|
reset_logger()
|
2012-08-10 01:37:52 +00:00
|
|
|
os.chdir(forge_dir)
|
|
|
|
print '=============================== Minecraft Forge Setup Finished ================================='
|
2012-08-01 23:35:35 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2012-12-10 02:58:01 +00:00
|
|
|
parser = OptionParser()
|
2012-12-10 23:43:40 +00:00
|
|
|
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None)
|
2012-12-10 02:58:01 +00:00
|
|
|
options, _ = parser.parse_args()
|
|
|
|
|
|
|
|
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'))
|