Files
2026-10-09 18:08:05 +08:00

31 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import zipfile, json, re
f = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_essentials-forge-1.20.1-1.0.0.jar'
z = zipfile.ZipFile(f)
en = json.loads(z.read('assets/sa_combat/lang/en_us.json').decode('utf-8'))
zh = json.loads(z.read('assets/sa_combat/lang/zh_cn.json').decode('utf-8'))
print('=== en_us 中所有 blueprint.* key(及其zh值) ===')
for k, v in en.items():
if 'blueprint' in k:
print(f' {k} = {v!r} | zh: {zh.get(k, "<缺失>")!r}')
print()
print('=== 运行时 class 引用的 lang key(sa_combat namespace) ===')
pat = re.compile(rb'(?:tooltip|gui|container|block|item|creativetab|key|menu|entity|description)\.[a-z0-9_]+\.[a-z0-9_.]+')
refs = {}
for n in z.namelist():
if n.endswith('.class') and 'datagen' not in n:
data = z.read(n)
for m in pat.findall(data):
try:
s = m.decode()
except:
continue
if s.startswith('tooltip.') or s.startswith('gui.') or s.startswith('creativetab.') or s.startswith('key.') or s.startswith('menu.'):
refs.setdefault(s, set()).add(n)
for k in sorted(refs):
print(f' {k}')
for c in sorted(refs[k]):
print(f' <- {c}')