Created
November 15, 2022 23:00
-
-
Save makamys/e8668436ed1780c0623c26936d0e472d 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
import zipfile | |
import sys | |
import java_manifest | |
if len(sys.argv) != 2: | |
sys.exit('''Usage: {} JAR_PATH | |
Generates JVM and program arguments needed to launch a mod in an IDE directly, given a jar of it.'''.format(sys.argv[0])) | |
man = java_manifest.loads(zipfile.ZipFile(sys.argv[1]).open("META-INF/MANIFEST.MF", "r").read().decode("utf8"))[0] | |
jvmArgs = [] | |
programArgs = [] | |
if "TweakClass" in man: | |
programArgs += ["--tweakClass " + man["TweakClass"]] | |
if "MixinConfigs" in man: | |
programArgs += ["--mixin " + x for x in man["MixinConfigs"].split(",")] | |
if "FMLCorePlugin" in man: | |
jvmArgs += ["-Dfml.coreMods.load=" + man["FMLCorePlugin"]] | |
print("JVM arguments:") | |
print(" ".join(jvmArgs)) | |
print() | |
print("Program arguments:") | |
print(" ".join(programArgs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment