37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import zipfile, os, re
|
|
|
|
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")
|
|
|
|
# ForgeSRG names for vanilla MobEffects fields we saw used by herbs
|
|
targets = {
|
|
b"f_19605_": "f_19605_",
|
|
b"f_19617_": "f_19617_",
|
|
b"f_19618_": "f_19618_",
|
|
b"f_19621_": "f_19621_",
|
|
}
|
|
hits = {k: [] for k in targets}
|
|
with zipfile.ZipFile(jar) as z:
|
|
for n in z.namelist():
|
|
if n.endswith('.class'):
|
|
data = z.read(n)
|
|
for k in targets:
|
|
if k in data:
|
|
hits[k].append(n)
|
|
for k, v in hits.items():
|
|
print("=" * 20, k.decode(), len(v))
|
|
for x in v[:60]:
|
|
print(" ", x)
|
|
|
|
# Also: all distinct f_196xx_ tokens used anywhere, with frequency
|
|
allf = {}
|
|
with zipfile.ZipFile(jar) as z:
|
|
for n in z.namelist():
|
|
if n.endswith('.class'):
|
|
data = z.read(n)
|
|
for m in set(re.findall(rb'f_\d{5}_', data)):
|
|
allf.setdefault(m.decode(), 0)
|
|
allf[m.decode()] += 1
|
|
print("=== all MobEffects-ish SRG tokens (top 60) ===")
|
|
for k in sorted(allf):
|
|
print(" ", k, allf[k]) |