汤锅计时音效,菜谱 UI 补登记(豆腐鲑鱼汤 = 菜谱 26),非空锅被左键打碎掉落对应空锅,饮料分组碰撞箱修改
This commit is contained in:
1 parent
ed49a10930
commit
c0dd6d8dbe
21 files changed
+369
-168
No files matched your search
+61
-2
@@ -83,6 +83,20 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
# ---- 右键冷却表 ----
|
||||
self.cooldown = {}
|
||||
|
||||
# ---- 所有"炒锅形态"方块(被左键打碎时一律掉 炒锅(空)) ----
|
||||
# 覆盖: 规则里出现过的 方块/产物/计时源/计时产物(含随机产物), 排除 炒锅(空)本体
|
||||
self.potBlocks = set()
|
||||
for r in SWITCH_RULES:
|
||||
self.potBlocks.add(r.get("block"))
|
||||
self.potBlocks.add(r.get("target"))
|
||||
for r in TIMER_RULES:
|
||||
self.potBlocks.add(r.get("source"))
|
||||
self.potBlocks.add(r.get("target"))
|
||||
for t in (r.get("randomTargets") or ()):
|
||||
self.potBlocks.add(t)
|
||||
self.potBlocks.discard(None)
|
||||
self.potBlocks.discard(WOK)
|
||||
|
||||
# ---- 注册到统一分发器 ----
|
||||
FeatureDispatcher.register(self)
|
||||
|
||||
@@ -91,8 +105,8 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
# ============================================================================
|
||||
|
||||
def getFeatureBlocks(self):
|
||||
"""返回本功能管辖的所有右键方块名集合"""
|
||||
return self.featureBlocks
|
||||
"""返回本功能管辖的所有右键方块名集合(含锅形态, 供"打碎掉空锅"路由)"""
|
||||
return self.featureBlocks | self.potBlocks
|
||||
|
||||
def getItemUseOnRules(self):
|
||||
"""手持物品右键方块表面路由: 盖饭成品菜 + 米饭三形态(盖饭/蛋炒饭)"""
|
||||
@@ -410,3 +424,48 @@ class ChaoguoService(BlueFoxServerSystem):
|
||||
return False
|
||||
self.cooldown[key] = now
|
||||
return True
|
||||
|
||||
# ============================================================================
|
||||
# 十、被左键打碎: 非空炒锅一律掉 炒锅(空)
|
||||
# ============================================================================
|
||||
|
||||
def handleDestroy(self, args):
|
||||
"""由 FeatureDispatcher 转发的"玩家左键破坏方块"入口。
|
||||
炒锅系列(除 炒锅(空) 本体外)被打碎: 取消默认掉落(不掉"半成品锅"本体),
|
||||
改为掉落 炒锅(空)。炒锅(空)本体不在 potBlocks 中, 保持默认掉自己。
|
||||
返回 True=本功能处理了这次破坏; False=不归本功能管(交还默认掉落)。"""
|
||||
# ServerPlayerTryDestroyBlockEvent 的方块名字段是 fullName(不是 blockName)
|
||||
blockName = args.get("fullName") or args.get("blockName")
|
||||
if blockName not in self.potBlocks:
|
||||
return False
|
||||
playerId = args.get("playerId")
|
||||
x, y, z = args.get("x"), args.get("y"), args.get("z")
|
||||
pos = (x, y, z)
|
||||
dim = comp.CreateDimension(playerId).GetEntityDimensionId()
|
||||
|
||||
# 取消默认破坏+默认掉落(不让"半成品锅"本身掉出来)
|
||||
args['cancel'] = True
|
||||
args['spawnResources'] = False
|
||||
|
||||
# 记录朝向aux, 再清空方块为空气(aux必须为0)
|
||||
aux = 0
|
||||
try:
|
||||
old = comp.CreateBlockInfo(LevelId).GetBlockNew(pos, dim)
|
||||
aux = old.get("aux", 0)
|
||||
except Exception:
|
||||
aux = 0
|
||||
try:
|
||||
comp.CreateBlockInfo(LevelId).SetBlockNew(
|
||||
pos, blockDict={"name": "minecraft:air", "aux": 0},
|
||||
oldBlockHandling=0, dimensionId=dim)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 掉落 炒锅(空)(保留朝向)
|
||||
try:
|
||||
self.CreateEngineItemEntity(
|
||||
{"itemName": WOK, "count": 1, "auxValue": aux},
|
||||
dim, (x, y + 0.5, z))
|
||||
except Exception:
|
||||
pass
|
||||
return True
|
||||
Reference in new issue
Block a user