ceshi 2 bug处理ok
This commit is contained in:
1 parent
b768ff1555
commit
faa3a22631
8 files changed
+314
-52
No files matched your search
@@ -103,6 +103,72 @@ try:
|
||||
except Exception:
|
||||
YOUGUO_SWITCH, YOUGUO_PLATE = None, None
|
||||
|
||||
# ---- 根因B: 各"手持可放置/可投掷物品右键功能方块"走 ServerBlockUseEvent 的转换规则表.
|
||||
# 字段用 source/block + item(块字段统一为 source; 不同服务可能用 source 或 block, 取兼容). ----
|
||||
_BLOCK_USE_TABLES = []
|
||||
|
||||
# 动物养殖(鸡窝放蛋/饲料槽/水槽 等): AnimalData.ANIMAL_SWITCHES
|
||||
try:
|
||||
from ..dongwuyangzhi.AnimalData import ANIMAL_SWITCHES as ANIMAL_RS
|
||||
_BLOCK_USE_TABLES.append(ANIMAL_RS)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 烧烤(上杆: 支杆+生肉/鱼): BarbecueData.BARBECUE_SWITCHES
|
||||
try:
|
||||
from ..shaokao.BarbecueData import BARBECUE_SWITCHES as BBQ_RS
|
||||
_BLOCK_USE_TABLES.append(BBQ_RS)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 死亡生物(挂肉钩: 死鱼+钩/尸体挂放): DeadmobData.DEADMOB_SWITCHES
|
||||
try:
|
||||
from ..siwangshengwu.DeadmobData import DEADMOB_SWITCHES as DEADMOB_RS
|
||||
_BLOCK_USE_TABLES.append(DEADMOB_RS)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 厨具(炉灶/丸子机/石磨: 木条+炉灶 等): ChujuData.STOVE_RULES / MEATBALLMAKER_RULES
|
||||
try:
|
||||
from ..chuju.ChujuData import (STOVE_RULES as CHUJU_STOVE,
|
||||
MEATBALLMAKER_RULES as CHUJU_MEAT,
|
||||
STEAMER_RULES as CHUJU_STEAM)
|
||||
_BLOCK_USE_TABLES.extend([CHUJU_STOVE, CHUJU_MEAT, CHUJU_STEAM])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 面食(面粉加水/揉面 等): MianshiData.SWITCH_RULES
|
||||
try:
|
||||
from ..mianshi.MianshiData import SWITCH_RULES as MIANSHI_SWITCH
|
||||
_BLOCK_USE_TABLES.append(MIANSHI_SWITCH)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 炒锅(放料: 手持食材右键炒锅等): ChaoguoData.SWITCH_RULES
|
||||
# (放料/翻炒走 handleBlockUse; 其中 action==take_out 的"盘子出锅"已由 TAKEOUT_CANCEL
|
||||
# 专用通道处理, 派生时过滤掉, 避免与盛出走 TakeoutRequest 冲突)
|
||||
try:
|
||||
from ..chaoguo.ChaoguoData import SWITCH_RULES as CHAOGUO_BLOCKUSE
|
||||
_BLOCK_USE_TABLES.append(CHAOGUO_BLOCKUSE)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 汤锅(放料: 手持食材/锅态汤右键汤锅等): TangguoData.SWITCH_RULES
|
||||
# 同样过滤 action==take_out(盛出走 TakeoutRequest)
|
||||
try:
|
||||
from ..tangguo.TangguoData import SWITCH_RULES as TANGGUO_BLOCKUSE
|
||||
_BLOCK_USE_TABLES.append(TANGGUO_BLOCKUSE)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 油锅(放料: 手持食材右键油锅等): YouguoData.SWITCH_RULES
|
||||
# 同样过滤 action==take_out(出锅走 TakeoutRequest)
|
||||
try:
|
||||
from ..youguo.YouguoData import SWITCH_RULES as YOUGUO_BLOCKUSE
|
||||
_BLOCK_USE_TABLES.append(YOUGUO_BLOCKUSE)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ---- 原版放置/盘子转换 (itemUseOn, surface=相邻放置 / source=盘子) ----
|
||||
try:
|
||||
from ..yuanbanfangzhi.YuanbanData import (
|
||||
@@ -186,6 +252,37 @@ if CHAOGUO_USON:
|
||||
if isinstance(_it, basestring) and _it and isinstance(_bk, basestring) and _bk:
|
||||
GAI_FAN_CANCEL.add((_it, _bk))
|
||||
|
||||
# ============================================================================
|
||||
# 三之C、根因B "手持可放置/可投掷物品右键功能方块" -> BlockUse 显式事件拦截
|
||||
# 客户端拦(手持物品, 功能方块)的放置/投掷预览后, NotifyToServer(BLOCK_USE_REQUEST),
|
||||
# 服务端 OnBlockUseRequest 按被点方块路由到对应服务的 handleBlockUse。
|
||||
# 仅取"手持物品非空"(item != None 且非 * 通配) 的转换对 —— 空手右键(item=None)
|
||||
# 不涉及放置预览, 不需要拦截, 仍走正常 ServerBlockUseEvent。
|
||||
# ============================================================================
|
||||
BLOCKUSE_CANCEL = set()
|
||||
for _tbl in _BLOCK_USE_TABLES:
|
||||
for _r in _as_list(_tbl):
|
||||
if not isinstance(_r, dict):
|
||||
continue
|
||||
_it = _r.get("item")
|
||||
if not _it or not isinstance(_it, basestring) or _it.startswith("*"):
|
||||
continue # 只看"手持具体物品"的转换; 空手/通配不拦
|
||||
# 炒锅 SWITCH_RULES 的 action==take_out(盘子出锅) 已由 TAKEOUT_CANCEL 专用通道处理,
|
||||
# 这里跳过, 避免与盛出走 TakeoutRequest 冲突; 其余(放料/翻炒)走 BlockUse。
|
||||
if _r.get("action") == "take_out":
|
||||
continue
|
||||
# 被点方块: 兼容 source(主流) 与 block(个别)
|
||||
_bk = _r.get("source") or _r.get("block")
|
||||
if isinstance(_bk, basestring) and _bk:
|
||||
BLOCKUSE_CANCEL.add((_it, _bk))
|
||||
|
||||
# BlockUse 转换涉及的全部手持物品集合(客户端 OnItemTryUse 也需取消默认"使用/投掷/倒水",
|
||||
# 否则手持鸡蛋右键鸡窝会被当成投掷扔出去; 水桶倒水同理)。
|
||||
# 只取原版/可"使用"的物品(minecraft: 前缀)进入 TryUse 取消; rtdd 方块物品不触发 TryUse。
|
||||
BLOCKUSE_CANCEL_ITEMS = set(
|
||||
_it for (_it, _bk) in BLOCKUSE_CANCEL if _it.startswith("minecraft:")
|
||||
)
|
||||
|
||||
# ---- Chuju 锅铲/油罐 inline 转换(在 ChujuService.handleItemUseOn 内联, 不在数据表) ----
|
||||
# 手持 锅铲/带油锅铲 右键 油罐(oilcan)/炒锅(wok) 蘸油/还油/上油 -> 取消默认
|
||||
CHUJU_INLINE_CANCEL = {
|
||||
|
||||
Reference in new issue
Block a user