import zipfile, os, subprocess base = r"e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\0aaaa4f2f16c46e8964025a5ab0ecc02\_sa_hanhua_out" jar = os.path.join(base, "sa_essentials-forge-1.20.1-1.0.0.jar") out = os.path.join(base, "_tmp", "herb_javap") os.makedirs(out, exist_ok=True) classes = [ "com/ogaba/sa_survival/item/common/ConsumableHerbBlockItem.class", "com/ogaba/sa_survival/item/common/ConsumableHerbBlockItem$Builder.class", "com/ogaba/sa_survival/block/custom/HerbBlock.class", "com/ogaba/sa_survival/registry/SASurvivalItems.class", "com/ogaba/sa_survival/registry/SASurvivalBlocks.class", ] with zipfile.ZipFile(jar) as z: for c in classes: if c not in z.namelist(): print("MISSING", c); continue dst = os.path.join(out, os.path.basename(c)) with open(dst, 'wb') as f: f.write(z.read(c)) for c in classes: name = os.path.basename(c)[:-6] full = "com.ogaba.sa_survival." + c.split("com/ogaba/sa_survival/")[1][:-6].replace('/', '.') txt = subprocess.run(["javap", "-p", "-c", "-classpath", jar, full], capture_output=True, text=True, errors='ignore').stdout fn = os.path.join(out, name + ".txt") with open(fn, 'w', encoding='utf-8') as f: f.write(txt) print("WROTE", fn, len(txt))