代码库初始化
This commit is contained in:
1 parent
07786ab323
commit
4334694551
851 files changed
+42626
No files matched your search
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""剔除 water_bottle / water_bottle2 / blank 三个材料(水瓶带模型、空白为占位物品)"""
|
||||
import os, json
|
||||
|
||||
BASE = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a'
|
||||
DROP = ['water_bottle', 'water_bottle2', 'blank']
|
||||
|
||||
# 1) 删 beh/res json + 贴图
|
||||
for sub in ['behavior_pack_kcH4M5u0/netease_items_beh', 'resource_pack_t7eJjrxY/netease_items_res']:
|
||||
for m in DROP:
|
||||
p = os.path.join(BASE, sub, 'dn_sa_%s.json' % m)
|
||||
if os.path.exists(p):
|
||||
os.remove(p)
|
||||
print('删', sub.split('/')[-1], m)
|
||||
for m in DROP:
|
||||
p = os.path.join(BASE, 'resource_pack_t7eJjrxY/textures/items/%s.png' % m)
|
||||
if os.path.exists(p):
|
||||
os.remove(p)
|
||||
print('删贴图', m)
|
||||
|
||||
# 2) item_texture.json 移除
|
||||
IP = os.path.join(BASE, 'resource_pack_t7eJjrxY/textures/item_texture.json')
|
||||
it = json.load(open(IP, encoding='utf-8'))
|
||||
for m in DROP:
|
||||
it['texture_data'].pop('dn_sa:%s' % m, None)
|
||||
json.dump(it, open(IP, 'w', encoding='utf-8'), ensure_ascii=False, indent=4)
|
||||
print('item_texture 移除后条数:', len(it['texture_data']))
|
||||
|
||||
# 3) zh_CN.lang 移除 name 行
|
||||
LP = os.path.join(BASE, 'resource_pack_t7eJjrxY/texts/zh_CN.lang')
|
||||
lines = open(LP, encoding='utf-8').read().splitlines()
|
||||
keep = []
|
||||
removed = 0
|
||||
for l in lines:
|
||||
if any(('item.dn_sa:%s.' % m) in l for m in DROP):
|
||||
removed += 1
|
||||
continue
|
||||
keep.append(l)
|
||||
open(LP, 'w', encoding='utf-8').write('\n'.join(keep) + ('\n' if keep else ''))
|
||||
print('lang 移除行:', removed, '| 剩余行:', len(keep))
|
||||
|
||||
# 4) 最终数量
|
||||
beh = [f for f in os.listdir(os.path.join(BASE, 'behavior_pack_kcH4M5u0/netease_items_beh')) if f.endswith('.json')]
|
||||
print('beh json 总数:', len(beh))
|
||||
print('材料数:', len(beh) - 44)
|
||||
Reference in new issue
Block a user