# -*- coding: utf-8 -*- """剔除 dirty_water_bottle(脏水瓶,带模型)""" import os, json BASE = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a' DROP = ['dirty_water_bottle'] 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/dirty_water_bottle.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:dirty_water_bottle', 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:dirty_water_bottle.')] 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)