汤锅功能实现 5 计时 提示修改 蔬菜鱼片汤补充 锅铲添油实现
This commit is contained in:
1 parent
31bb44a409
commit
c342dcc93d
12 files changed
+585
-395
No files matched your search
@@ -7,19 +7,20 @@
|
||||
ChujuService / ChujuTimerService 读取,FeatureDispatcher 通过方块名/物品名
|
||||
集合路由到对应服务。
|
||||
|
||||
【本次实现的五大功能】
|
||||
【本次实现的六大功能】
|
||||
1) 炉灶 (stove + 木条 -> 加木条 -> 打火石/烈焰弹 -> 点燃) 纯右键
|
||||
2) 丸子机 (面团 -> 鱿鱼须 -> 任意配料 -> 计时半熟 -> 计时熟 -> 盘子取) 右键+计时
|
||||
3) 搅拌器 (肉/牛奶/蛋 分别搅打; 牛奶+蛋互通; 蛋+木碗=奶油; +盘子=蛋液) 纯右键
|
||||
4) 石磨 (黄豆 -> 研磨旋转4次 -> 玻璃罐装油罐) 右键+计数
|
||||
5) 蒸笼 (盖盖/掀盖 双向) 纯右键
|
||||
6) 锅铲蘸油/上油 (锅铲<->带油锅铲 附魔光效; 油罐方块次数16用完变玻璃罐;
|
||||
带油锅铲右键炒锅 -> 炒锅(添油)) 手持物品互换
|
||||
|
||||
【留后】(到具体菜品/分类时再实现, 本模块不处理)
|
||||
- 盘子 plate_0 -> 脏盘子 plate_0a
|
||||
- 油罐 oilcan -> 空油锅/炒锅上油 (18/18a)
|
||||
- 锅铲 <-> 带油锅铲 上油 (19/19a/20)
|
||||
- 油罐直接上油空炒锅 (18a)
|
||||
- 蒸笼蒸熟 (13)
|
||||
- 锅铲/锅勺/菜刀/擀面杖的具体用法 (21~24)
|
||||
- 锅铲翻炒/锅勺翻煮/菜刀切割/擀面杖擀面 具体用法 (21~24)
|
||||
|
||||
【计时说明】
|
||||
丸子机 _3(加料完成) -> 30秒 -> _4(半熟) -> 30秒 -> _5(熟) 为两段连续计时,
|
||||
@@ -111,6 +112,19 @@ STONEMILL_GRIND_COUNT = 4 # 右键4次完成研磨
|
||||
GLASS_TANK_ITEM = "rtdd:medicinetank" # 玻璃罐(取出油罐)
|
||||
OIL_CAN_ITEM = "rtdd:oilcan" # 油罐(石磨产物)
|
||||
|
||||
# ============================================================================
|
||||
# 四B、手持厨具物品(七、手持厨具物品): 锅铲 <-> 带油锅铲, 油罐蘸油/上油炒锅
|
||||
# 19. 锅铲(spatula) 右键油罐(oilcan) -> 带油锅铲(spatula_oil, 附魔光效), 油罐次数-1
|
||||
# 19a.带油锅铲 右键油罐 -> 变回锅铲, 油罐次数+1
|
||||
# 20. 带油锅铲 右键炒锅(wok) -> 炒锅变炒锅(添油)(oilpan), 油铲变回锅铲
|
||||
# 油罐方块初始次数16次, 用完变玻璃罐(rtdd:medicinetank); 次数存方块实体 rtdd_oc
|
||||
# ============================================================================
|
||||
SPATULA = "rtdd:spatula" # 锅铲(手持物品)
|
||||
SPATULA_OIL = "rtdd:spatula_oil" # 带油锅铲(手持物品, 附魔光效)
|
||||
WOK = "rtdd:wok" # 炒锅(方块)
|
||||
OIL_PAN = "rtdd:oilpan" # 炒锅(添油)(方块)
|
||||
OIL_CAN_USES = 16 # 油罐方块初始可用次数(用完变玻璃罐)
|
||||
|
||||
# ============================================================================
|
||||
# 五、蒸笼 (steamer 空 <-> steamercover 加盖) 双向
|
||||
# ============================================================================
|
||||
|
||||
+127
-5
@@ -48,6 +48,7 @@ from ..ChujuData import (
|
||||
BOWL_ITEM, PLATE_ITEM, CREAM_ITEM, EGG_CUSTARD_ITEM, BEATER_BLOCKS,
|
||||
SOYBEAN_ITEM, SOYBEAN_COUNT, STONEMILL_GRIND_COUNT,
|
||||
GLASS_TANK_ITEM, OIL_CAN_ITEM, STEAMER_RULES,
|
||||
SPATULA, SPATULA_OIL, WOK, OIL_PAN, OIL_CAN_USES,
|
||||
)
|
||||
|
||||
# ---- 统一分发器 ----
|
||||
@@ -82,7 +83,8 @@ class ChujuService(BlueFoxServerSystem):
|
||||
# ---- 空手右键"丸子机计时源"(meatballmaker_3/4): 放在点燃炉灶上 -> 开始计时 ----
|
||||
# 提示包含"总共多少秒": _3(加料完成) 半熟30秒+熟30秒=60秒; _4(半熟) 剩30秒
|
||||
self.timerSources = set()
|
||||
self.startTimerTips = {}
|
||||
self.startTimerTips = {} # 空手右键启动计时 -> 提示(含总共多少秒)
|
||||
self.timingTips = {} # 空手右键"已在计时中" -> 提示(同样含总共多少秒)
|
||||
for r in MEATBALL_TIMERS:
|
||||
src = r["source"]
|
||||
self.timerSources.add(src)
|
||||
@@ -91,8 +93,10 @@ class ChujuService(BlueFoxServerSystem):
|
||||
sec = r.get("time", 60)
|
||||
if src == "rtdd:meatballmaker_3":
|
||||
self.startTimerTips[src] = "§a开始烹制…共需计时60秒(半熟30秒+熟30秒); 计时结束变成 章鱼小丸子"
|
||||
self.timingTips[src] = "§e正在烹制中…共需计时60秒(半熟30秒+熟30秒), 计时结束变成 章鱼小丸子"
|
||||
else:
|
||||
self.startTimerTips[src] = "§a开始烹制…共需计时%d秒; 计时结束变成 章鱼小丸子" % sec
|
||||
self.timingTips[src] = "§e正在烹制中…共需计时%d秒, 计时结束变成 章鱼小丸子" % sec
|
||||
|
||||
# ---- 右键冷却表 ----
|
||||
self.cooldown = {}
|
||||
@@ -109,8 +113,38 @@ class ChujuService(BlueFoxServerSystem):
|
||||
return self.featureBlocks
|
||||
|
||||
def getItemUseOnRules(self):
|
||||
"""手持物品右键方块表面不需要单独路由, 返回空"""
|
||||
return {}
|
||||
"""手持物品右键方块表面路由: 锅铲/带油锅铲 右键 油罐/炒锅 (蘸油/还油/上油)"""
|
||||
return {SPATULA: True, SPATULA_OIL: True}
|
||||
|
||||
def handleItemUseOn(self, args):
|
||||
"""手持 锅铲/带油锅铲 右键 方块表面:
|
||||
19. 锅铲(spatula) 右键油罐(oilcan) -> 变带油锅铲(附魔光效), 油罐次数-1(用完变玻璃罐)
|
||||
19a. 带油锅铲 右键油罐 -> 变回锅铲, 油罐次数+1
|
||||
20. 带油锅铲 右键炒锅(wok) -> 炒锅变炒锅(添油)(oilpan), 油铲变回锅铲
|
||||
物品形态变化直接替换手持物品(不掉落物)。
|
||||
返回 True=处理了; False=不属本功能管(交还默认行为)。"""
|
||||
itemName = args.get("itemName")
|
||||
playerId = args.get("playerId") or args.get("entityId")
|
||||
x, y, z = args.get("x"), args.get("y"), args.get("z")
|
||||
pos = (x, y, z)
|
||||
dim = comp.CreateDimension(playerId).GetEntityDimensionId()
|
||||
key = (dim, x, y, z)
|
||||
try:
|
||||
b = comp.CreateBlockInfo(LevelId).GetBlockNew(pos, dim)
|
||||
clickedName = b.get("name") if b else None
|
||||
except Exception:
|
||||
clickedName = None
|
||||
|
||||
# 19: 锅铲 蘸油罐
|
||||
if itemName == SPATULA and clickedName == OIL_CAN_ITEM:
|
||||
return self._dipOil(playerId, key, dim, pos)
|
||||
# 19a: 带油锅铲 还油罐
|
||||
if itemName == SPATULA_OIL and clickedName == OIL_CAN_ITEM:
|
||||
return self._returnOil(playerId, key, dim, pos)
|
||||
# 20: 带油锅铲 给炒锅上油
|
||||
if itemName == SPATULA_OIL and clickedName == WOK:
|
||||
return self._oilWok(playerId, key, dim, pos)
|
||||
return False
|
||||
|
||||
def handleBlockUse(self, args):
|
||||
"""
|
||||
@@ -157,13 +191,101 @@ class ChujuService(BlueFoxServerSystem):
|
||||
self.handleSwitch(recipe, playerId, pos, dim, itemDict, key)
|
||||
return True
|
||||
|
||||
def _dipOil(self, playerId, key, dim, pos):
|
||||
"""19. 锅铲蘸油罐: 变带油锅铲(附魔光效), 油罐次数-1; 用完(0次)油罐变玻璃罐"""
|
||||
if not self.checkCooldown(key, 0.4):
|
||||
return True
|
||||
uses = self._readOilUses(dim, pos)
|
||||
if uses <= 0:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§c油罐没油了, 无法蘸油")
|
||||
return True
|
||||
self._setCarriedItem(playerId, SPATULA_OIL, True) # 替换手持为带油锅铲(附魔光效)
|
||||
uses -= 1
|
||||
if uses <= 0:
|
||||
self._clearOilUses(dim, pos)
|
||||
self.replaceBlock(pos, dim, GLASS_TANK_ITEM, playerId) # 油罐用完变玻璃罐
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§a锅铲蘸了油, 变成带油锅铲; 油罐用完了, 变成了玻璃罐")
|
||||
else:
|
||||
self._writeOilUses(dim, pos, uses)
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§a锅铲蘸了油, 变成带油锅铲; 油罐剩余 %d 次" % uses)
|
||||
return True
|
||||
|
||||
def _returnOil(self, playerId, key, dim, pos):
|
||||
"""19a. 带油锅铲还油罐: 变回锅铲, 油罐次数+1"""
|
||||
if not self.checkCooldown(key, 0.4):
|
||||
return True
|
||||
uses = self._readOilUses(dim, pos)
|
||||
if uses >= OIL_CAN_USES:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§e油罐是满的, 不用还油")
|
||||
return True
|
||||
self._setCarriedItem(playerId, SPATULA, False) # 替换手持为锅铲(去附魔)
|
||||
uses += 1
|
||||
self._writeOilUses(dim, pos, uses)
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§a油还回油罐, 变回锅铲; 油罐剩余 %d 次" % uses)
|
||||
return True
|
||||
|
||||
def _oilWok(self, playerId, key, dim, pos):
|
||||
"""20. 带油锅铲给炒锅上油: 炒锅变炒锅(添油), 油铲变回锅铲(不消耗油铲)"""
|
||||
if not self.checkCooldown(key, 0.4):
|
||||
return True
|
||||
self._setCarriedItem(playerId, SPATULA, False) # 替换手持为锅铲
|
||||
self.replaceBlock(pos, dim, OIL_PAN, playerId)
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§a炒锅添了油, 变成 炒锅(添油); 带油锅铲变回锅铲")
|
||||
return True
|
||||
|
||||
def _setCarriedItem(self, playerId, itemName, enchanted):
|
||||
"""直接替换玩家手持物品(不掉落物); 带油锅铲时附加魔光效(效率I)"""
|
||||
itemDict = {"itemName": itemName, "count": 1, "auxValue": 0}
|
||||
if enchanted:
|
||||
itemDict["userData"] = {"ench": [
|
||||
{"id": {"__type__": 2, "__value__": 15},
|
||||
"lvl": {"__type__": 2, "__value__": 1},
|
||||
"modEnchant": {"__type__": 8, "__value__": ""}},
|
||||
]}
|
||||
comp.CreateItem(playerId).SetEntityItem(
|
||||
serverApi.GetMinecraftEnum().ItemPosType.CARRIED, itemDict)
|
||||
|
||||
def _readOilUses(self, dim, pos):
|
||||
"""油罐方块剩余次数(未记录过/新放置 = 满16次)"""
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data is None:
|
||||
return OIL_CAN_USES
|
||||
v = data["rtdd_oc"]
|
||||
if v is None:
|
||||
return OIL_CAN_USES
|
||||
return int(v)
|
||||
except Exception:
|
||||
return OIL_CAN_USES
|
||||
|
||||
def _writeOilUses(self, dim, pos, uses):
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data is not None:
|
||||
data["rtdd_oc"] = int(uses)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _clearOilUses(self, dim, pos):
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data is not None:
|
||||
data["rtdd_oc"] = 0
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _handleStartTimer(self, blockName, playerId, pos, dim):
|
||||
"""空手右键丸子机计时源(meatballmaker_3/4): 已在计时中 -> 提示;
|
||||
"""空手右键丸子机计时源(meatballmaker_3/4): 已在计时中 -> 提示总时长;
|
||||
否则转发计时服务开始(下方需点燃的炉灶 stove_2)"""
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data and data["rtdd_tid"] == blockName:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§e已经在计时中")
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, self.timingTips.get(blockName, "§e已经在计时中"))
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
+6
-3
@@ -96,7 +96,8 @@ class MianshiService(BlueFoxServerSystem):
|
||||
# ---- 空手右键"蒸笼计时源"(蒸X_生): 放在点燃炉灶上 -> 开始计时 ----
|
||||
# 蒸笼蒸制的计时源(下方必须点燃炉灶)才登记, 烤炉/发酵等走各自机制
|
||||
self.timerSources = set()
|
||||
self.startTimerTips = {}
|
||||
self.startTimerTips = {} # 空手右键启动计时 -> 提示(含总共多少秒)
|
||||
self.timingTips = {} # 空手右键"已在计时中" -> 提示(同样含总共多少秒)
|
||||
for r in TIMER_RULES:
|
||||
if LIT_STOVE not in (r.get("below") or []):
|
||||
continue
|
||||
@@ -107,6 +108,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
sec = r.get("time", 60)
|
||||
tgt = NAME_MAP.get(r["target"], r["target"])
|
||||
self.startTimerTips[src] = "§a开始蒸制…共需计时%d秒; 计时结束变成 %s" % (sec, tgt)
|
||||
self.timingTips[src] = "§e正在蒸制中…共需计时%d秒, 计时结束变成 %s" % (sec, tgt)
|
||||
|
||||
# ---- 结果方块/物品 -> "下一步"可读提示(供转换/入笼提示追加) ----
|
||||
# 例子: 饺子皮 -> "加入 猪肉馅、青菜碎"; 可颂面胚 -> "放在烤炉上等计时(60秒)结束变成 可颂"
|
||||
@@ -298,12 +300,13 @@ class MianshiService(BlueFoxServerSystem):
|
||||
return True
|
||||
|
||||
def _handleStartTimer(self, blockName, playerId, pos, dim):
|
||||
"""空手右键蒸笼计时源(蒸X_生): 已在计时中 -> 提示;
|
||||
"""空手右键蒸笼计时源(蒸X_生): 已在计时中 -> 提示总时长;
|
||||
否则转发计时服务开始(下方需点燃的炉灶 stove_2)"""
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data and data["rtdd_tid"] == blockName:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§e已经在计时中")
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, self.timingTips.get(blockName, "§e已经在计时中"))
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -337,7 +337,7 @@ SWITCH_RULES = [
|
||||
"tip": "§a蘑菇汤加生鸡肉, 开始熬制(共270秒, 3级×90秒); 等计时结束变成 蘑菇炖鸡(熟), 手持木碗出锅"},
|
||||
{"block": VEGETABLE_SOUP, "item": SASHIMI, "target": VEGETABLE_FISH_SOUP_0,
|
||||
"consume": 10, "startTimer": VEGETABLE_FISH_SOUP_0,
|
||||
"tip": "§a蔬菜汤加生鱼片x10, 开始计时熬制(60秒/级); 等计时结束变成 蔬菜鱼片汤(熟), 手持木碗出锅"},
|
||||
"tip": "§a蔬菜汤加生鱼片x10, 开始熬制(共180秒, 3级×60秒); 等计时结束变成 蔬菜鱼片汤(熟), 手持木碗出锅"},
|
||||
|
||||
# ---------------- 五、单独菜谱 ----------------
|
||||
# 菜谱29 猪蹄汤
|
||||
@@ -667,4 +667,11 @@ TIMER_RULES = [
|
||||
# 煮豆腐(单级60秒)
|
||||
{"source": BEANCURD_SOUP_0, "target": BEANCURD_SOUP_1, "time": 60,
|
||||
"below": [LIT_STOVE], "autoStart": True},
|
||||
# 蔬菜鱼片汤(60秒/级, 3级)
|
||||
{"source": VEGETABLE_FISH_SOUP_0, "target": VEGETABLE_FISH_SOUP_1, "time": 60,
|
||||
"below": [LIT_STOVE], "autoStart": True},
|
||||
{"source": VEGETABLE_FISH_SOUP_1, "target": VEGETABLE_FISH_SOUP_2, "time": 60,
|
||||
"below": [LIT_STOVE], "autoStart": True},
|
||||
{"source": VEGETABLE_FISH_SOUP_2, "target": VEGETABLE_FISH_SOUP_3, "time": 60,
|
||||
"below": [LIT_STOVE], "autoStart": True},
|
||||
]
|
||||
+9
-3
@@ -94,7 +94,8 @@ class TangguoService(BlueFoxServerSystem):
|
||||
self._finalNames[r["block"]] = nm
|
||||
|
||||
self.timerSources = set()
|
||||
self.startTimerTips = {}
|
||||
self.startTimerTips = {} # 空手右键启动计时 -> 提示(含总共多少秒)
|
||||
self.timingTips = {} # 空手右键"已在计时中" -> 提示(同样含总共多少秒)
|
||||
for src, r in self._timerBySrc.items():
|
||||
self.timerSources.add(src)
|
||||
self.featureBlocks.add(src) # 登记右键路由, 空手右键才分发到这里
|
||||
@@ -107,12 +108,16 @@ class TangguoService(BlueFoxServerSystem):
|
||||
stage = "(%d级: %s)" % (len(stages), "→".join("%d秒" % s for s in stages))
|
||||
if r.get("randomTargets"):
|
||||
tip = "§a开始煮饭…共需计时%d秒%s; 计时结束变成 熟米饭(形态随机)" % (total, stage)
|
||||
t2 = "§e正在煮饭中…共需计时%d秒%s, 计时结束变成 熟米饭(形态随机)" % (total, stage)
|
||||
else:
|
||||
tip = "§a开始熬制…共需计时%d秒%s" % (total, stage)
|
||||
t2 = "§e正在熬制中…共需计时%d秒%s" % (total, stage)
|
||||
end = self._timerTerminalName(src)
|
||||
if end:
|
||||
tip += "; 计时结束变成 %s" % end
|
||||
t2 += ", 计时结束变成 %s" % end
|
||||
self.startTimerTips[src] = tip
|
||||
self.timingTips[src] = t2
|
||||
|
||||
# ---- 右键冷却表 ----
|
||||
self.cooldown = {}
|
||||
@@ -161,11 +166,12 @@ class TangguoService(BlueFoxServerSystem):
|
||||
return True
|
||||
|
||||
def _handleStartTimer(self, blockName, playerId, pos, dim):
|
||||
"""空手右键生汤羹等: 已在计时中 -> 提示; 否则转发计时服务开始(下方需点燃炉灶)"""
|
||||
"""空手右键生汤羹等: 已在计时中 -> 提示总时长; 否则转发计时服务开始(下方需点燃炉灶)"""
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data and data["rtdd_tid"] == blockName:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§e已经在计时中")
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, self.timingTips.get(blockName, "§e已经在计时中"))
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
+8
-3
@@ -86,7 +86,8 @@ class YouguoService(BlueFoxServerSystem):
|
||||
self._finalNames[r["block"]] = nm
|
||||
|
||||
self.timerSources = set()
|
||||
self.startTimerTips = {}
|
||||
self.startTimerTips = {} # 空手右键启动计时 -> 提示(含总共多少秒)
|
||||
self.timingTips = {} # 空手右键"已在计时中" -> 提示(同样含总共多少秒)
|
||||
for src, r in self._timerBySrc.items():
|
||||
self.timerSources.add(src)
|
||||
self.featureBlocks.add(src)
|
||||
@@ -96,10 +97,13 @@ class YouguoService(BlueFoxServerSystem):
|
||||
else:
|
||||
stage = "(%d级: %s)" % (len(stages), "→".join("%d秒" % s for s in stages))
|
||||
tip = "§a开始炸制…共需计时%d秒%s" % (total, stage)
|
||||
t2 = "§e正在炸制中…共需计时%d秒%s" % (total, stage)
|
||||
end = self._oilTerminalName(src)
|
||||
if end:
|
||||
tip += "; 计时结束变成 %s" % end
|
||||
t2 += ", 计时结束变成 %s" % end
|
||||
self.startTimerTips[src] = tip
|
||||
self.timingTips[src] = t2
|
||||
|
||||
# ---- 右键冷却表 ----
|
||||
self.cooldown = {}
|
||||
@@ -147,11 +151,12 @@ class YouguoService(BlueFoxServerSystem):
|
||||
return True
|
||||
|
||||
def _handleStartTimer(self, blockName, playerId, pos, dim):
|
||||
"""空手右键炸物生/半熟: 已在计时中 -> 提示; 否则转发计时服务开始(下方需点燃炉灶)"""
|
||||
"""空手右键炸物生/半熟: 已在计时中 -> 提示总时长; 否则转发计时服务开始(下方需点燃炉灶)"""
|
||||
try:
|
||||
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
|
||||
if data and data["rtdd_tid"] == blockName:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§e已经在计时中")
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, self.timingTips.get(blockName, "§e已经在计时中"))
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user