import zipfile, os, subprocess, shutil jar = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_essentials-forge-1.20.1-1.0.0.jar' out = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\_tmp\classes' targets = [ 'com/ogaba/sa_combat/client/tooltip/BlueprintClientTooltipComponent.class', 'com/ogaba/sa_combat/item/BlueprintTooltipComponent.class', 'com/ogaba/sa_combat/item/BlueprintItem.class', ] javap = r'D:\我的世界\bin\javap.EXE' if not os.path.exists(javap): javap = shutil.which('javap') report = [] for t in targets: cname = t[:-6].replace('/', '.') r = subprocess.run([javap, '-c', '-p', '-classpath', out, cname], capture_output=True, text=True, encoding='utf-8', errors='replace') text = r.stdout if r.returncode == 0 else r.stderr report.append('='*20 + ' ' + cname + ' ' + '='*20 + '\n' + text) full = '\n\n'.join(report) with open(r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\_tmp\javap_blueprint.txt', 'w', encoding='utf-8') as f: f.write(full) print('written, total len:', len(full)) # 关键搜索:getDisplayName / Survivors / displayName / 所有字符串常量 import re print('\n--- getDisplayName / mod 相关调用 ---') for line in full.splitlines(): if 'getDisplayName' in line or 'DisplayName' in line or 'Survivors' in line or 'getModId' in line or 'mods.toml' in line: print(line) print('\n--- 所有 String 常量 ---') for line in full.splitlines(): m = re.search(r'String ([^\s]*(?:blueprint|mod|Mod)[^\s]*)', line) if m: print(line.strip())