Created
November 1, 2012 00:56
-
-
Save TkTech/3990960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
import sys | |
from jawa import JarFile, ConstantString | |
try: | |
from cStringIO import StringIO | |
except ImportError: | |
from StringIO import StringIO | |
with JarFile(sys.argv[1]) as jf: | |
for path in (p for p in jf.namelist if p.endswith('.class')): | |
cf = ClassFile(StringIO(jf.read(path))) | |
for c in cf.constants.find(ConstantString, lambda s: 'Minecraft 1.3.2' in s.string.value): | |
with c.string as string: | |
string.value = string.value.replace('1.3.2', '1.5.0') | |
o = StringIO() | |
cf.save(o) | |
jf.write(path, o.getvalue()) | |
o.close() | |
jf.remove('META-INF/MOJANG_C.DSA') | |
jf.remove('META-INF/MOJANG_C.SF') | |
jf.save('minecraft.jar') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment