Cleaned up forge scripts, and updated AT config for 1.3.2, deleted any reference to server specific code.
This commit is contained in:
parent
77fd7add11
commit
9aa5d69679
5 changed files with 46 additions and 289 deletions
|
@ -1,68 +1,53 @@
|
|||
#Main Forge Access Transformer configuration file
|
||||
# RailLogic.getNAdjacentTracks
|
||||
public ahh.a(Lahh;)I
|
||||
public ahi.a(Lahh;)I
|
||||
# Tessellator
|
||||
public avd.u # drawMode
|
||||
public avd.v # xOffset
|
||||
public avd.w # yOffset
|
||||
public avd.x # zOffset
|
||||
public-f avd.a # instance remove final
|
||||
public avd.z # isDrawing
|
||||
public ave.u # drawMode
|
||||
public ave.v # xOffset
|
||||
public ave.w # yOffset
|
||||
public ave.x # zOffset
|
||||
public-f ave.a # instance remove final
|
||||
public ave.z # isDrawing
|
||||
# ItemPickaxe
|
||||
public+f rp.c # blocksEffectiveAgainst
|
||||
public+f rq.c # blocksEffectiveAgainst
|
||||
# ItemAxe
|
||||
public+f re.c # blocksEffectiveAgainst
|
||||
public+f rf.c # blocksEffectiveAgainst
|
||||
# ItemSpade
|
||||
public+f sa.c # blocksEffectiveAgainst
|
||||
public+f sb.c # blocksEffectiveAgainst
|
||||
# ItemTool
|
||||
public gs.a # efficiencyOnProperMaterial
|
||||
public gs.bY # damageVsEntity
|
||||
public gt.a # efficiencyOnProperMaterial
|
||||
public gt.bY # damageVsEntity
|
||||
# EntityEnderman
|
||||
public no.d # carriableBlocks
|
||||
public np.d # carriableBlocks
|
||||
# RenderEngine
|
||||
public ave.k # texturePack
|
||||
public avf.k # texturePack
|
||||
# RenderGlobal
|
||||
public ava.h # theWorld
|
||||
public ava.i # renderEngine
|
||||
public ava.q # mc
|
||||
public ava.r # globalRenderBlocks
|
||||
public avb.h # theWorld
|
||||
public avb.i # renderEngine
|
||||
public avb.q # mc
|
||||
public avb.r # globalRenderBlocks
|
||||
# SoundManager
|
||||
public ayp.a # sndSystem
|
||||
public ayp.b # soundPoolSounds
|
||||
public ayp.c # soundPoolStreaming
|
||||
public ayp.d # soundPoolMusic
|
||||
public ayq.a # sndSystem
|
||||
public ayq.b # soundPoolSounds
|
||||
public ayq.c # soundPoolStreaming
|
||||
public ayq.d # soundPoolMusic
|
||||
# EntityLiving
|
||||
public jv.aM # carryoverDamage
|
||||
# EntityPlayerMP
|
||||
public gt.bO()V # incrementWindowID()
|
||||
public gt.cq # currentWindowId
|
||||
public jw.aM # carryoverDamage
|
||||
# EntityMinecart
|
||||
protected nj.d # cargoItems
|
||||
protected nj.e # fuel
|
||||
protected nj.f #
|
||||
protected nj.g #
|
||||
protected nj.h # turnProgress
|
||||
protected nj.i # minecartX
|
||||
protected nj.j # minecartY
|
||||
protected nj.an # minecartZ
|
||||
protected nj.ao # minecartYaw
|
||||
protected nj.ap # minecartPitch
|
||||
protected nj.aq # velocityX
|
||||
protected nj.ar # velocityY
|
||||
protected nj.as # velocityZ
|
||||
protected nk.* # All private -> protected
|
||||
public nj.h()Z # isMinecartPowered
|
||||
# Block
|
||||
public aif.<init>(ILacn;)V #Constructor
|
||||
public aif.<init>(IILacn;)V #Constructor
|
||||
public aif.p()Laif; # setRequiresSelfNotify
|
||||
public aif.a(Laii;)Laif; # setStepSound
|
||||
public aif.b(F)Laif; # setResistance
|
||||
public aif.c(F)Laif; # setHardness
|
||||
public aif.h(I)Laif; # setLightOpacity
|
||||
public aif.a(F)Laif; # setLightValue
|
||||
public aif.q()Laif; # setBlockUnbreakable
|
||||
public aif.b(Z)Laif; # setTickRandomly
|
||||
public aig.<init>(ILaco;)V #Constructor
|
||||
public aig.<init>(IILaco;)V #Constructor
|
||||
public aig.p()Laif; # setRequiresSelfNotify
|
||||
public aig.a(Laij;)Laig; # setStepSound
|
||||
public aig.b(F)Laig; # setResistance
|
||||
public aig.c(F)Laig; # setHardness
|
||||
public aig.h(I)Laig; # setLightOpacity
|
||||
public aig.a(F)Laig; # setLightValue
|
||||
public aig.q()Laig; # setBlockUnbreakable
|
||||
public aig.b(Z)Laig; # setTickRandomly
|
||||
# NetServerHandler
|
||||
public gy.g # playerInAirTime
|
||||
public gz.g # playerInAirTime
|
||||
# TileEntity
|
||||
public ajh.k # worldObj
|
||||
public aji.k # worldObj
|
204
forge.py
204
forge.py
|
@ -80,214 +80,20 @@ 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 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 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', '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 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'))
|
||||
|
||||
def get_conf_copy(mcp_dir, forge_dir):
|
||||
#Lets grab the files we dont work on
|
||||
for file in ['astyle.cfg', 'version.cfg', 'patches/minecraft_ff.patch', 'patches/minecraft_server_ff.patch', 'newids.csv']:
|
||||
dst_file = os.path.normpath(os.path.join(forge_dir, 'conf', file))
|
||||
src_file = os.path.normpath(os.path.join(mcp_dir, 'conf', file))
|
||||
if os.path.exists(dst_file):
|
||||
os.remove(dst_file)
|
||||
shutil.copy(src_file, dst_file)
|
||||
print 'Grabbing: ' + src_file
|
||||
|
||||
common_srg = gen_merged_srg(mcp_dir, forge_dir)
|
||||
common_exc = gen_merged_exc(mcp_dir, forge_dir)
|
||||
common_map = gen_shared_searge_names(common_srg, common_exc)
|
||||
#ToDo use common_map to merge the remaining csvs, client taking precidense, setting the common items to side '2' and editing commands.py in FML to have 'if csv_side == side || csv_side == '2''
|
||||
gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'fields.csv'), os.path.join(forge_dir, 'conf', 'fields.csv'))
|
||||
gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'methods.csv'), os.path.join(forge_dir, 'conf', 'methods.csv'))
|
||||
gen_merged_csv(common_map, os.path.join(mcp_dir, 'conf', 'params.csv'), os.path.join(forge_dir, 'conf', 'params.csv'), main_key='param')
|
||||
|
||||
def gen_merged_srg(mcp_dir, forge_dir):
|
||||
print 'Generating merged Retroguard data'
|
||||
srg_client = os.path.join(mcp_dir, 'conf', 'client.srg')
|
||||
srg_server = os.path.join(mcp_dir, 'conf', 'server.srg')
|
||||
|
||||
if not os.path.isfile(srg_client) or not os.path.isfile(srg_server):
|
||||
print 'Could not find client and server srg files in "%s"' % mcp_dir
|
||||
return False
|
||||
|
||||
client = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
|
||||
with open(srg_client, 'r') as fh:
|
||||
for line in fh:
|
||||
pts = line.rstrip('\r\n').split(' ')
|
||||
if pts[0] == 'MD:':
|
||||
client[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4]
|
||||
else:
|
||||
client[pts[0]][pts[1]] = pts[2]
|
||||
|
||||
server = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
|
||||
with open(srg_server, 'r') as fh:
|
||||
for line in fh:
|
||||
pts = line.rstrip('\r\n').split(' ')
|
||||
if pts[0] == 'MD:':
|
||||
server[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4]
|
||||
else:
|
||||
server[pts[0]][pts[1]] = pts[2]
|
||||
|
||||
common = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
|
||||
for type in common:
|
||||
for key, value in client[type].items():
|
||||
if key in server[type]:
|
||||
if value == server[type][key]:
|
||||
client[type].pop(key)
|
||||
server[type].pop(key)
|
||||
common[type][key] = value
|
||||
|
||||
for type in common:
|
||||
for key, value in client[type].items():
|
||||
common[type][key] = value #+ ' #C'
|
||||
|
||||
for type in common:
|
||||
for key, value in server[type].items():
|
||||
common[type][key] = value #+ ' #S'
|
||||
|
||||
#Print joined retroguard files
|
||||
with open(os.path.join(forge_dir, 'conf', 'joined.srg'), 'w') as f:
|
||||
for type in ['PK:', 'CL:', 'FD:', 'MD:']:
|
||||
for key in sorted(common[type]):
|
||||
f.write('%s %s %s\n' % (type, key, common[type][key]))
|
||||
|
||||
return common
|
||||
|
||||
def gen_merged_exc(mcp_dir, forge_dir):
|
||||
print 'Generating merged MCInjector config'
|
||||
exc_client = os.path.join(mcp_dir, 'conf', 'client.exc')
|
||||
exc_server = os.path.join(mcp_dir, 'conf', 'server.exc')
|
||||
|
||||
client = {}
|
||||
with open(exc_client, 'r') as fh:
|
||||
for line in fh:
|
||||
if not line.startswith('#'):
|
||||
pts = line.rstrip('\r\n').split('=')
|
||||
client[pts[0]] = pts[1]
|
||||
|
||||
server = {}
|
||||
with open(exc_server, 'r') as fh:
|
||||
for line in fh:
|
||||
if not line.startswith('#'):
|
||||
pts = line.rstrip('\r\n').split('=')
|
||||
server[pts[0]] = pts[1]
|
||||
|
||||
common = {}
|
||||
for key, value in client.items():
|
||||
if key in server:
|
||||
if value != server[key]:
|
||||
print 'Error: Exec for shared function does not match client and server:'
|
||||
print 'Function: ' + key
|
||||
print 'Client: ' + value
|
||||
print 'Server: ' + server[value]
|
||||
if value != '|':
|
||||
common[key] = value
|
||||
client.pop(key)
|
||||
server.pop(key)
|
||||
else:
|
||||
if value != '|':
|
||||
common[key] = value
|
||||
|
||||
joined = dict(common.items() + server.items())
|
||||
|
||||
#Print joined mcinjector files
|
||||
with open(os.path.join(forge_dir, 'conf', 'joined.exc'), 'w') as f:
|
||||
for key in sorted(joined):
|
||||
f.write('%s=%s\n' % (key, joined[key]))
|
||||
|
||||
return common
|
||||
|
||||
def gen_shared_searge_names(common_srg, common_exc):
|
||||
field = re.compile(r'field_[0-9]+_[a-zA-Z_]+$')
|
||||
method = re.compile(r'func_[0-9]+_[a-zA-Z_]+')
|
||||
param = re.compile(r'p_[\w]+_\d+_')
|
||||
|
||||
print 'Gathering list of common searge names'
|
||||
|
||||
searge = []
|
||||
|
||||
for key, value in common_srg['FD:'].items():
|
||||
m = field.search(value)
|
||||
if not m is None:
|
||||
if not m.group(0) in searge:
|
||||
searge.append(m.group(0))
|
||||
|
||||
for key, value in common_srg['MD:'].items():
|
||||
m = method.search(value)
|
||||
if not m is None and not '#' in value:
|
||||
if not m.group(0) in searge:
|
||||
searge.append(m.group(0))
|
||||
|
||||
for key, value in common_exc.items():
|
||||
m = param.findall(value)
|
||||
if not m is None:
|
||||
for p in m:
|
||||
if not p in searge:
|
||||
searge.append(p)
|
||||
|
||||
return searge
|
||||
|
||||
def gen_merged_csv(common_map, in_file, out_file, main_key='searge'):
|
||||
reader = csv.DictReader(open(in_file, 'r'))
|
||||
print 'Generating merged csv for %s' % os.path.basename(in_file)
|
||||
sides = {'client': [], 'server': [], 'common': []}
|
||||
added = []
|
||||
for row in reader:
|
||||
side = int(row['side'])
|
||||
if row[main_key] in common_map:
|
||||
if not row[main_key] in added:
|
||||
row['side'] = '2'
|
||||
sides['common'].append(row)
|
||||
added.append(row[main_key])
|
||||
elif side == 0:
|
||||
sides['client'].append(row)
|
||||
else:
|
||||
sides['server'].append(row)
|
||||
|
||||
writer = csv.DictWriter(open(out_file, 'wb'), fieldnames=reader.fieldnames)
|
||||
writer.writeheader()
|
||||
for key in ['client', 'server', 'common']:
|
||||
for row in sorted(sides[key], key=lambda row: row[main_key]):
|
||||
writer.writerow(row)
|
||||
|
||||
def setup_forge_mcp(mcp_dir, forge_dir, dont_gen_conf=True):
|
||||
mcp_conf = os.path.join(mcp_dir, 'conf')
|
||||
mcp_conf_bak = os.path.join(mcp_dir, 'conf.bak')
|
||||
forge_conf = os.path.join(forge_dir, 'conf')
|
||||
|
||||
if os.path.isdir(mcp_conf_bak):
|
||||
print 'Removing old conf backup folder'
|
||||
shutil.rmtree(mcp_conf_bak)
|
||||
|
||||
if not dont_gen_conf:
|
||||
get_conf_copy(mcp_dir, forge_dir)
|
||||
|
||||
print 'Backing up MCP Conf'
|
||||
os.rename(mcp_conf, mcp_conf_bak)
|
||||
|
||||
print 'Copying Forge conf'
|
||||
shutil.copytree(forge_conf, mcp_conf)
|
||||
|
||||
def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0):
|
||||
version = load_version(build_num)
|
||||
print '=================================== Build %d.%d.%d.%d Start =================================' % (version['major'], version['minor'], version['revision'], version['build'])
|
||||
|
@ -303,8 +109,6 @@ def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0):
|
|||
copytree(os.path.join(mcp_dir, 'src_work'), src_dir)
|
||||
print '\nCopying Client Code'
|
||||
copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'), -1)
|
||||
print '\nCopying Server Code'
|
||||
copytree(os.path.join(forge_dir, 'server'), os.path.join(src_dir, 'minecraft_server'), -1)
|
||||
print '\nCopying Common Code'
|
||||
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'common'), -1)
|
||||
print
|
||||
|
|
21
release.py
21
release.py
|
@ -74,7 +74,6 @@ def main():
|
|||
zip_start('minecraftforge-src-%s.zip' % version_str, 'forge')
|
||||
zip_add('client', 'client')
|
||||
zip_add('common', 'common')
|
||||
zip_add('server', 'server')
|
||||
zip_add('patches', 'patches')
|
||||
zip_add('fml', 'fml')
|
||||
zip_add('install/install.cmd')
|
||||
|
@ -92,7 +91,6 @@ def main():
|
|||
print '=================================== Release Finished %d =================================' % error_level
|
||||
sys.exit(error_level)
|
||||
|
||||
|
||||
def zip_add(file, key=None):
|
||||
if key == None:
|
||||
key = os.path.basename(file)
|
||||
|
@ -108,23 +106,6 @@ def zip_add(file, key=None):
|
|||
print key
|
||||
zip.write(file, key)
|
||||
|
||||
def zip_add_perm(file, perm, key=None):
|
||||
if key == None:
|
||||
key = os.path.basename(file)
|
||||
else:
|
||||
key = key.replace('/', os.sep)
|
||||
if not zip_base is None:
|
||||
key = os.path.join(zip_base, key)
|
||||
file = os.path.join(forge_dir, file.replace('/', os.sep))
|
||||
if os.path.isfile(file):
|
||||
print key
|
||||
#zip.write(file, key)
|
||||
|
||||
with open(file, 'r') as fh: data = fh.read()
|
||||
info = zipfile.ZipInfo(key)
|
||||
info.external_attr = 0777 << 16L
|
||||
zip.writestr(info, data)
|
||||
|
||||
def zip_start(name, base=None):
|
||||
global zip, zip_name, zip_base
|
||||
zip_name = name
|
||||
|
@ -170,8 +151,8 @@ def extract_fml_obfed():
|
|||
|
||||
for line in lines:
|
||||
line = line.replace('\n', '').replace('\r', '').replace('/', os.sep)
|
||||
print line
|
||||
if not os.path.isfile(os.path.join(reobf_dir, line)):
|
||||
print line
|
||||
side = line.split(os.sep)[0]
|
||||
if side == 'minecraft':
|
||||
client.extract(line[10:].replace(os.sep, '/'), client_dir)
|
||||
|
|
21
setup.py
21
setup.py
|
@ -7,12 +7,11 @@ forge_dir = os.path.dirname(os.path.abspath(__file__))
|
|||
mcp_dir = os.path.abspath('..')
|
||||
src_dir = os.path.join(mcp_dir, 'src')
|
||||
|
||||
from forge import setup_forge_mcp, apply_forge_patches
|
||||
from forge import apply_forge_patches
|
||||
|
||||
def main():
|
||||
print '=================================== Setup Start ================================='
|
||||
dont_gen_conf = True #'-no_gen_conf' in sys.argv
|
||||
setup_fml(dont_gen_conf)
|
||||
setup_fml()
|
||||
|
||||
base_dir = os.path.join(mcp_dir, 'src_base')
|
||||
work_dir = os.path.join(mcp_dir, 'src_work')
|
||||
|
@ -29,21 +28,9 @@ def main():
|
|||
print 'Applying forge patches'
|
||||
apply_forge_patches(os.path.join(forge_dir, 'fml'), mcp_dir, forge_dir, work_dir, False)
|
||||
|
||||
#Restore mcp/conf.bak, therefore restoring normal MCP updating ability
|
||||
if not dont_gen_conf:
|
||||
mcp_conf = os.path.join(mcp_dir, 'conf')
|
||||
mcp_conf_bak = os.path.join(mcp_dir, 'conf.bak')
|
||||
|
||||
if os.path.isdir(mcp_conf):
|
||||
print 'Removing new conf folder'
|
||||
shutil.rmtree(mcp_conf)
|
||||
|
||||
print 'Restoreing original MCP Conf'
|
||||
os.rename(mcp_conf_bak, mcp_conf)
|
||||
|
||||
print '=================================== Setup Finished ================================='
|
||||
|
||||
def setup_fml(dont_gen_conf):
|
||||
def setup_fml():
|
||||
print 'Setting up Forge ModLoader'
|
||||
fml = glob.glob(os.path.join(forge_dir, 'fml-src-*.zip'))
|
||||
if not len(fml) == 1:
|
||||
|
@ -66,7 +53,7 @@ def setup_fml(dont_gen_conf):
|
|||
|
||||
sys.path.append(fml_dir)
|
||||
from install import fml_main
|
||||
fml_main(fml_dir, mcp_dir, dont_gen_conf)
|
||||
fml_main(fml_dir, mcp_dir, True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in a new issue