调整ai数据

This commit is contained in:
Giao committed 2026-10-09 18:08:05 +08:00
1 parent f8c300a4c6
commit c2f5cd98ff
493 files changed
+7 -7

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
"""对比 Java 模组 sa_core 汉化,统一网易版 66 个材料的中文名"""
import zipfile, json, os, csv
BASE = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a'
DROP = {'box_of_nails', 'box_of_paperclips', 'box_of_screws', 'gunpowder_bottle', 'rope',
'water_bottle', 'water_bottle2', 'blank', 'empty_glass_bottle', 'falsh_lights'}
# 1) Java 版 sa_core 汉化物品名映射
z = zipfile.ZipFile(os.path.join(BASE, '_sa_hanhua_out', 'sa_lib-forge-1.20.1-1.0.1.jar'))
zh = json.loads(z.read('assets/sa_core/lang/zh_cn.json'))
z.close()
jnames = {}
for k, v in zh.items():
# 格式: item.sa_core.<reg>(无 .name 后缀)
if k.startswith('item.sa_core.') and '.' not in k[len('item.sa_core.'):]:
jnames[k[len('item.sa_core.'):]] = v
print('Java 版物品名条目:', len(jnames))
# 2) 66 个材料
mats = []
with open(os.path.join(BASE, '_sa_materials.csv'), encoding='utf-8-sig') as f:
for row in csv.reader(f):
if row and row[1].endswith('.png') and row[0].isdigit() and row[1][:-4] not in DROP:
mats.append(row[1][:-4])
print('网易版材料数:', len(mats))
# 3) 对比 lang
LP = os.path.join(BASE, 'resource_pack_t7eJjrxY/texts/zh_CN.lang')
lang = open(LP, encoding='utf-8').read()
replaced, no_java, same = [], [], []
lines = lang.splitlines()
new_lines = []
for l in lines:
hit = None
for m in mats:
prefix = 'item.dn_sa:%s.name=' % m
if l.startswith(prefix):
hit = (m, l[len(prefix):])
break
if hit:
m, cur = hit
if m in jnames:
jv = jnames[m]
if jv != cur:
new_lines.append('%s%s' % (prefix, jv))
replaced.append((m, cur, jv))
else:
new_lines.append(l)
same.append((m, jv))
else:
new_lines.append(l)
no_java.append((m, cur))
else:
new_lines.append(l)
open(LP, 'w', encoding='utf-8').write('\n'.join(new_lines) + ('\n' if new_lines else ''))
print('已替换(与Java版不一致):', len(replaced))
for m, c, j in replaced: print(' 改:', m, '| 原:', c, '->', j)
print('一致未改:', len(same))
print('Java版无此名称(保留网易名):', len(no_java))
for m, c in no_java: print(' 保留:', m, '=', c)