汤锅功能实现 6

This commit is contained in:
wenhe committed 2026-09-16 14:08:24 +08:00
1 parent c342dcc93d
commit 72172ba09c
8 files changed
+679 -568

No files matched your search

@@ -3,7 +3,7 @@
================================================================================
厨具·右键转换引擎(服务端)
================================================================================
处理"厨具"(xy_kitchenware) 分类下的右键转换:
处理"厨具"(xy_kitchenware) 分类下的右键转换,
炉灶(加木条/点燃)、丸子机(放面团/放鱿鱼须/放配料/盘子取成品)、
搅拌器(肉/牛奶/蛋/鸡蛋牛奶/奶油/蛋液)、石磨(加黄豆/研磨/玻璃罐取油)、
蒸笼(盖盖/掀盖)。
@@ -17,7 +17,7 @@
所有事件由 FeatureDispatcher 统一监听, 按 blockOwner 路由到本类 handleBlockUse。
【本类怎么做(自上而下的方法系列)】
handleBlockUse ← 入口:分发器转发右键方块事件
handleBlockUse ← 入口,分发器转发右键方块事件
├─ _handleBeater ← 搅拌器(多分支, 需记录放入的肉类型)
├─ _handleStonemill ← 石磨(黄豆/研磨旋转/玻璃罐取油)
└─ handleSwitch ← 炉灶/丸子机/蒸笼 的通用开关规则
@@ -90,13 +90,13 @@ class ChujuService(BlueFoxServerSystem):
self.timerSources.add(src)
self.featureBlocks.add(src)
if src not in self.startTimerTips:
sec = r.get("time", 60)
if src == "rtdd:meatballmaker_3":
self.startTimerTips[src] = "§a开始烹制…共需计时60秒(半熟30秒+熟30秒); 计时结束变成 章鱼小丸子"
self.timingTips[src] = "§e正在烹制中…共需计时60秒(半熟30秒+熟30秒), 计时结束变成 章鱼小丸子"
self.startTimerTips[src] = "§a开始烹制(第1级/共2级): 还需60秒(每级30秒), 计时结束变成 章鱼小丸子, 手持盘子出锅"
self.timingTips[src] = "§e正在烹制中(第1级/共2级): 还需60秒(每级30秒), 计时结束变成 章鱼小丸子, 手持盘子出锅"
else:
self.startTimerTips[src] = "§a开始烹制…共需计时%d秒; 计时结束变成 章鱼小丸子" % sec
self.timingTips[src] = "§e正在烹制中…共需计时%d秒, 计时结束变成 章鱼小丸子" % sec
sec = r.get("time", 60)
self.startTimerTips[src] = "§a开始烹制(第2级/共2级): 还需%d秒, 计时结束变成 章鱼小丸子, 手持盘子出锅" % sec
self.timingTips[src] = "§e正在烹制中(第2级/共2级): 还需%d秒, 计时结束变成 章鱼小丸子, 手持盘子出锅" % sec
# ---- 右键冷却表 ----
self.cooldown = {}
@@ -209,7 +209,7 @@ class ChujuService(BlueFoxServerSystem):
else:
self._writeOilUses(dim, pos, uses)
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a锅铲蘸了油, 变成带油锅铲; 油罐剩余 %d 次" % uses)
playerId, "§a锅铲蘸了油, 变成带油锅铲; 油罐剩余 " + str(uses) + " 次")
return True
def _returnOil(self, playerId, key, dim, pos):
@@ -224,7 +224,7 @@ class ChujuService(BlueFoxServerSystem):
uses += 1
self._writeOilUses(dim, pos, uses)
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a油还回油罐, 变回锅铲; 油罐剩余 %d 次" % uses)
playerId, "§a油还回油罐, 变回锅铲; 油罐剩余 " + str(uses) + " 次")
return True
def _oilWok(self, playerId, key, dim, pos):
@@ -292,7 +292,7 @@ class ChujuService(BlueFoxServerSystem):
started = FeatureDispatcher.startTimerFor(blockName, dim, pos, playerId)
if started:
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, self.startTimerTips.get(blockName, "§a开始计时…"))
playerId, self.startTimerTips.get(blockName, "§a已启动计时"))
else:
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§c丸子机需要放在点燃的炉灶上才能开始烹制")
@@ -363,7 +363,7 @@ class ChujuService(BlueFoxServerSystem):
# ============================================================================
def _handleBeater(self, blockName, playerId, pos, dim, itemDict, itemName, key):
# ---------- 空搅拌器:放入第一份食材 ----------
# ---------- 空搅拌器,放入第一份食材 ----------
if blockName == "rtdd:beater":
if itemName in MEAT_ITEMS:
if (itemDict.get("count") or 0) < 2:
@@ -501,7 +501,7 @@ class ChujuService(BlueFoxServerSystem):
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a鸡蛋牛奶完成,可加盘子取蛋液")
else:
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§a搅打中…")
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§a搅打中,")
return True
return False
@@ -556,7 +556,7 @@ class ChujuService(BlueFoxServerSystem):
playerId, "§a研磨完成,可加玻璃罐取油")
else:
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a研磨中…(%d/%d)" % (newProg, STONEMILL_GRIND_COUNT))
playerId, "§a研磨中,(%d/%d)" % (newProg, STONEMILL_GRIND_COUNT))
return True
# ---- 完成: + 玻璃罐 -> 油罐 ----
@@ -655,7 +655,7 @@ class ChujuService(BlueFoxServerSystem):
pass
# ============================================================================
# 八、工具方法:获取玩家主手物品
# 八、工具方法,获取玩家主手物品
# ============================================================================
def getCarriedItem(self, playerId):
@@ -664,7 +664,7 @@ class ChujuService(BlueFoxServerSystem):
serverApi.GetMinecraftEnum().ItemPosType.CARRIED, 0, True)
# ============================================================================
# 九、工具方法:给玩家物品
# 九、工具方法,给玩家物品
# ============================================================================
def giveItem(self, playerId, itemName, count=1, aux=0):
@@ -675,7 +675,7 @@ class ChujuService(BlueFoxServerSystem):
pass
# ============================================================================
# 十、工具方法:消耗物品
# 十、工具方法,消耗物品
# ============================================================================
def consumeItem(self, playerId, itemDict, amount=1):
@@ -696,7 +696,7 @@ class ChujuService(BlueFoxServerSystem):
"userData": itemDict.get("userData", {})})
# ============================================================================
# 十一、工具方法:替换方块
# 十一、工具方法,替换方块
# ============================================================================
def replaceBlock(self, pos, dim, newBlockName, playerId=None):
@@ -712,7 +712,7 @@ class ChujuService(BlueFoxServerSystem):
oldBlockHandling=0, dimensionId=dim)
# ============================================================================
# 十二、工具方法:以掉落物形式生成物品
# 十二、工具方法,以掉落物形式生成物品
# ============================================================================
def dropItems(self, dim, pos, dropList):
@@ -725,7 +725,7 @@ class ChujuService(BlueFoxServerSystem):
self.CreateEngineItemEntity(itemDict, dim, (pos[0], pos[1] + 0.5, pos[2]))
# ============================================================================
# 十三、工具方法:冷却检查
# 十三、工具方法,冷却检查
# ============================================================================
def checkCooldown(self, key, cd=0.5):