代码库初始化

This commit is contained in:
Giao committed 2026-10-04 21:07:49 +08:00
1 parent 07786ab323
commit 4334694551
851 files changed
+42626

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
"""对齐 Java 版饮用效果:3 个有毒饮品加中毒+反胃;发胶/发酵糊移除饮用功能"""
import os, json
BASE = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a'
TOXIC = ['alcohol', 'rubbing_alcohol', 'cleaning_liquid']
PLAIN = ['hair_gel', 'fermented_mash']
# 1) 3 个有毒饮品:food 加 effects(中毒 II 10s + 反胃 15s)
for m in TOXIC:
p = os.path.join(BASE, 'behavior_pack_kcH4M5u0/netease_items_beh/dn_sa_%s.json' % m)
d = json.load(open(p, encoding='utf-8'))
c = d['minecraft:item']['components']
c['minecraft:food']['effects'] = [
{'name': 'poison', 'chance': 1.0, 'duration': 10, 'amplifier': 1},
{'name': 'nausea', 'chance': 1.0, 'duration': 15, 'amplifier': 0}
]
json.dump(d, open(p, 'w', encoding='utf-8'), ensure_ascii=False, indent=4)
print('加效果:', m)
# 2) 发胶/发酵糊:移除饮用功能(恢复普通物品)
for m in PLAIN:
p = os.path.join(BASE, 'behavior_pack_kcH4M5u0/netease_items_beh/dn_sa_%s.json' % m)
d = json.load(open(p, encoding='utf-8'))
c = d['minecraft:item']['components']
c.pop('minecraft:food', None)
c.pop('minecraft:use_duration', None)
json.dump(d, open(p, 'w', encoding='utf-8'), ensure_ascii=False, indent=4)
rp = os.path.join(BASE, 'resource_pack_t7eJjrxY/netease_items_res/dn_sa_%s.json' % m)
r = json.load(open(rp, encoding='utf-8'))
r['minecraft:item']['components'].pop('minecraft:use_animation', None)
json.dump(r, open(rp, 'w', encoding='utf-8'), ensure_ascii=False, indent=4)
print('移除饮用:', m)
# 验证
p = os.path.join(BASE, 'behavior_pack_kcH4M5u0/netease_items_beh/dn_sa_alcohol.json')
print(json.dumps(json.load(open(p, encoding='utf-8'))['minecraft:item']['components'], ensure_ascii=False))