29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""剔除 jerry_can(油桶,带模型)"""
|
|
import os, json
|
|
|
|
BASE = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a'
|
|
DROP = ['jerry_can']
|
|
|
|
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)
|
|
p = os.path.join(BASE, 'resource_pack_t7eJjrxY/textures/items/jerry_can.png')
|
|
if os.path.exists(p):
|
|
os.remove(p)
|
|
|
|
IP = os.path.join(BASE, 'resource_pack_t7eJjrxY/textures/item_texture.json')
|
|
it = json.load(open(IP, encoding='utf-8'))
|
|
it['texture_data'].pop('dn_sa:jerry_can', None)
|
|
json.dump(it, open(IP, 'w', encoding='utf-8'), ensure_ascii=False, indent=4)
|
|
|
|
LP = os.path.join(BASE, 'resource_pack_t7eJjrxY/texts/zh_CN.lang')
|
|
lines = open(LP, encoding='utf-8').read().splitlines()
|
|
keep = [l for l in lines if not l.startswith('item.dn_sa:jerry_can.')]
|
|
open(LP, 'w', encoding='utf-8').write('\n'.join(keep) + ('\n' if keep else ''))
|
|
|
|
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), '| 材料数:', len(beh) - 44)
|