Example #1
0
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
    sys.path.append(fml_dir)
    from fml import copytree, apply_patches
    
    has_client = os.path.isdir(os.path.join(src_dir, 'minecraft'))
    has_server = os.path.isdir(os.path.join(src_dir, 'minecraft_server'))
    
    #patch files
    print 'Applying Minecraft Forge patches'
    sys.stdout.flush()
    if has_client:
        if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')):
            apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
        if os.path.isdir(os.path.join(forge_dir, 'patches', 'common')):
            apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'common'), src_dir, '/common/', '/minecraft/')
        if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')):
            copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'))
        
    if has_server:
        if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft_server')):
            apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft_server'), src_dir)
        if os.path.isdir(os.path.join(forge_dir, 'patches', 'common')):
            apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'common'), src_dir, '/common/', '/minecraft_server/')
        if copy_files and os.path.isdir(os.path.join(forge_dir, 'server')):
            copytree(os.path.join(forge_dir, 'server'), os.path.join(src_dir, 'minecraft_server'))
            
    if os.path.isdir(os.path.join(forge_dir, 'patches', 'common')):
        apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'common'), src_dir)
    if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')):
        copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'common'))
Example #2
0
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
    sys.path.append(fml_dir)
    from fml import copytree, apply_patches
    
    #patch files
    print 'Applying Minecraft Forge patches'
    sys.stdout.flush()

    if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')):
        apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
        
    if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')):
        copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'))
    if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')):
        copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'))
Example #3
0
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
    sys.path.append(fml_dir)
    sys.path.append(os.path.join(fml_dir, 'install'))
    from fml import copytree, apply_patches
    
    #patch files
    print 'Applying Minecraft Forge patches'
    sys.stdout.flush()

    if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')):
        apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
        
    if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')):
        copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'))
    if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')):
        copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'))
spigot = "../CraftBukkit/src/main/java"  # Spigot-Server (patches applied)

print "Copying vanilla source"
if os.path.exists(outDir):
    shutil.rmtree(outDir)
if SPIGOT:
    shutil.copytree("../CraftBukkit/src/main/java", outDir)
else:
    shutil.copytree(vanillaSrc, outDir)
    shutil.copytree(os.path.join(obc, "org"), os.path.join(outDir, "org"))

if not SPIGOT:
    print "Applying CraftBukkit NMS patches"
    sys.path.append(os.path.join(fmlDir))
    import fml
    fml.apply_patches(mcpDir, cbPatches, os.path.join(outDir, "net"))  # .../

sys.path.append(mcpDir)
import runtime.commands

pushd = os.getcwd()
os.chdir(mcpDir)
commands = runtime.commands.Commands()

commands.srcserver = outDir
print "Adding javadoc"
commands.process_javadoc(runtime.commands.SERVER)
print "Renaming srg->csv"
commands.process_rename(runtime.commands.SERVER)

os.chdir(pushd)