面食 4
This commit is contained in:
1 parent
052e4844b2
commit
a4c5ad43e4
5 files changed
+163
-70
No files matched your search
+58
-31
@@ -19,10 +19,11 @@ MianshiService / MianshiTimerService 读取, FeatureDispatcher 通过
|
||||
甜点蛋糕: 木碗+面粉(加鸡蛋)面糊/烤熟/脱模/加奶油/蜂蜜/浆果/切分/布丁/舒芙蕾/蒸蛋奶
|
||||
|
||||
【计时(见 MianshiTimerService)】
|
||||
发酵60秒 / 烤炉烘焙60秒(下方判定烤炉, 烤炉被打碎 -> 方块掉落+提示) / 蒸笼蒸熟60秒
|
||||
发酵60秒 / 烤炉烘焙60秒(下方判定烤炉, 烤炉被打碎 -> 方块掉落+提示) /
|
||||
蒸笼蒸熟60秒(手持生食右键蒸笼入笼, 蒸X_生下方判定点燃的炉灶 stove_2)
|
||||
|
||||
【不实现(txt 已标 todo)】: 吃(熟肉包子/馍/煎饼卷/熟竹筒饭/蛋糕小块 右键吃)、
|
||||
巧克力蛋糕系列、蛋糕半块拆两块
|
||||
巧克力蛋糕系列
|
||||
================================================================================
|
||||
"""
|
||||
|
||||
@@ -40,7 +41,7 @@ VEGGIE = "rtdd:vegetable" # 青菜碎
|
||||
COOKED_BEEF = "minecraft:cooked_beef" # 熟牛肉(原版)
|
||||
COOKED_PORK = "minecraft:cooked_porkchop" # 熟猪肉(原版)
|
||||
COOKED_COD = "minecraft:cooked_cod" # 熟鳕鱼(原版)
|
||||
POTATO = "minecraft:potato" # 土豆(原版)
|
||||
POTATO = "minecraft:baked_potato" # 熟土豆(原版烤土豆)
|
||||
BROWN_RICE = "rtdd:brownrice" # 大米(生米)
|
||||
CREAM = "rtdd:cream_0" # 奶油
|
||||
HONEY = "minecraft:honey_bottle" # 蜂蜜
|
||||
@@ -50,6 +51,16 @@ PLATE = "rtdd:plate_0" # 盘子
|
||||
BOWL = "rtdd:bowlasoup" # 木碗
|
||||
STEAMER = "rtdd:steamer" # 蒸笼
|
||||
OVEN = "rtdd:oven" # 烤炉
|
||||
LIT_STOVE = "rtdd:stove_2" # 点燃的炉灶(蒸笼放其上, 蒸制计时判定)
|
||||
|
||||
# 放到烤炉上就"固定"的方块(禁止右键转换, 开始计时烤制):
|
||||
# 法棍面胚_1(未发面, 放上先发酵)/发面/吐司面胚/甜甜圈胚(生)/可颂面胚/
|
||||
# 蛋糕面糊(生)/蛋液半成品/舒芙蕾半成品
|
||||
OVEN_FIX_BLOCKS = {
|
||||
"rtdd:breaddough_1", "rtdd:breaddough_1a", "rtdd:breaddough_2",
|
||||
"rtdd:breaddough_4d", "rtdd:dought_9",
|
||||
"rtdd:cakebatterblock_0", "rtdd:plate_34", "rtdd:creampastry_0",
|
||||
}
|
||||
|
||||
# 竹筒饭加肉: 接受原版常见生熟肉类(【待确认】具体肉类未定, 先放开常见肉)
|
||||
MEAT_ITEMS = [
|
||||
@@ -75,14 +86,15 @@ RICH_MEAT_ITEMS = [COOKED_BEEF, COOKED_PORK]
|
||||
SWITCH_RULES = [
|
||||
# ---- 一、面粉·面团组 ----
|
||||
{"block": "rtdd:farineblcok", "item": EGG,
|
||||
"target": "rtdd:farineblock_1", "consume": 3, "tip": "§a面粉加了鸡蛋"},
|
||||
"target": "rtdd:farineblock_1", "consume": 3, "tip": "§a面粉加了鸡蛋(消耗3个)"},
|
||||
{"block": "rtdd:farineblock_1", "item": WATER_BUCKET,
|
||||
"target": "rtdd:farineblock_2", "consume": 1, "give": EMPTY_BUCKET,
|
||||
"tip": "§a面粉加水, 水桶变空桶"},
|
||||
{"block": "rtdd:rawdough_0", "item": None, "target": "rtdd:rawdough_1", "tip": "§a和面中…"},
|
||||
{"block": "rtdd:rawdough_1", "item": None, "target": "rtdd:rawdough_2", "tip": "§a和面中…"},
|
||||
{"block": "rtdd:rawdough_2", "item": None, "target": "rtdd:rawdough_3", "tip": "§a和面中…"},
|
||||
{"block": "rtdd:rawdough_3", "item": None, "target": "rtdd:rawdough_4", "tip": "§a和面完成"},
|
||||
{"block": "rtdd:rawdough_3", "item": None, "target": "rtdd:rawdough_4",
|
||||
"startTimer": "rtdd:rawdough_4", "tip": "§a和面完成, 开始发酵(60秒)"},
|
||||
{"block": "rtdd:rawdough_4", "item": CLEAVER, "action": "chop_smalldough",
|
||||
"tip": "§a切出了8个小面团"},
|
||||
{"block": "rtdd:dough_0", "item": ROLLINGPIN, "target": "rtdd:dough_1",
|
||||
@@ -130,7 +142,7 @@ SWITCH_RULES = [
|
||||
{"block": "rtdd:roubao_2", "item": None, "target": "rtdd:roubaozi_3",
|
||||
"tip": "§a塑形成生肉包子"},
|
||||
{"block": "rtdd:baozilong_2", "item": None, "action": "take_steamer",
|
||||
"dropItem": "rtdd:shouroubao", "tip": "§a取出熟肉包子, 蒸笼归位"},
|
||||
"dropItem": "rtdd:shouroubao", "dropCount": 3, "tip": "§a取出三个熟肉包子, 蒸笼归位"},
|
||||
{"block": "rtdd:shouroubao", "item": CLEAVER, "target": "rtdd:shoubaozi_2",
|
||||
"tip": "§a切出半个"},
|
||||
{"block": "rtdd:shoubaozi_2", "item": CLEAVER, "target": "rtdd:shoubaozi_3",
|
||||
@@ -148,17 +160,17 @@ SWITCH_RULES = [
|
||||
{"block": "rtdd:roujiamo_0", "item": CLEAVER, "target": "rtdd:roujiamo_1",
|
||||
"tip": "§a馍切开"},
|
||||
{"block": "rtdd:roujiamo_1", "item": COOKED_BEEF, "target": "rtdd:roujiamo_2",
|
||||
"tip": "§a夹入熟牛肉"},
|
||||
"consume": 2, "tip": "§a夹入熟牛肉(消耗2个)"},
|
||||
{"block": "rtdd:roujiamo_1", "item": COOKED_PORK, "target": "rtdd:roujiamo_2",
|
||||
"tip": "§a夹入熟猪肉"},
|
||||
"consume": 2, "tip": "§a夹入熟猪肉(消耗2个)"},
|
||||
|
||||
# ---- 五、煎饼卷组 ----
|
||||
{"block": "rtdd:cooked_dought", "item": VEGGIE, "target": "rtdd:cookeddought_1",
|
||||
"tip": "§a煎饼加了青菜碎"},
|
||||
"consume": 1, "tip": "§a煎饼加了青菜碎"},
|
||||
{"block": "rtdd:cookeddought_1", "item": COOKED_BEEF, "target": "rtdd:cookeddought_2",
|
||||
"tip": "§a加入熟牛肉"},
|
||||
"consume": 1, "tip": "§a加入熟牛肉"},
|
||||
{"block": "rtdd:cookeddought_2", "item": POTATO, "target": "rtdd:cookeddought_3",
|
||||
"tip": "§a加入土豆"},
|
||||
"consume": 1, "tip": "§a加入土豆"},
|
||||
{"block": "rtdd:cookeddought_3", "item": None, "target": "rtdd:cookeddought_4",
|
||||
"tip": "§a卷制中…"},
|
||||
{"block": "rtdd:cookeddought_4", "item": None, "target": "rtdd:cookeddought_5",
|
||||
@@ -168,7 +180,7 @@ SWITCH_RULES = [
|
||||
{"block": "rtdd:cookeddought_1", "item": COOKED_COD, "target": "rtdd:cookedcoddought_2",
|
||||
"tip": "§a加入熟鳕鱼"},
|
||||
{"block": "rtdd:cookedcoddought_2", "item": POTATO, "target": "rtdd:cookedcoddought_3",
|
||||
"tip": "§a加入土豆"},
|
||||
"consume": 1, "tip": "§a加入土豆"},
|
||||
{"block": "rtdd:cookedcoddought_3", "item": None, "target": "rtdd:cookedcoddought_4",
|
||||
"tip": "§a卷制中…"},
|
||||
{"block": "rtdd:cookedcoddought_4", "item": None, "target": "rtdd:cookedcoddought_5",
|
||||
@@ -180,7 +192,7 @@ SWITCH_RULES = [
|
||||
{"block": "rtdd:bamboo_0", "item": CLEAVER, "target": "rtdd:bamboo_1",
|
||||
"tip": "§a竹筒切开"},
|
||||
{"block": "rtdd:bamboo_1", "item": BROWN_RICE, "target": "rtdd:bamboo_2",
|
||||
"consume": 32, "tip": "§a竹筒填满生大米"},
|
||||
"consume": 32, "tip": "§a竹筒填满生大米(消耗32个)"},
|
||||
{"block": "rtdd:bamboo_7", "item": None, "action": "take_steamer",
|
||||
"dropItem": "rtdd:bamboo_5", "tip": "§a取出熟竹筒饭, 蒸笼归位"},
|
||||
|
||||
@@ -222,7 +234,7 @@ SWITCH_RULES = [
|
||||
|
||||
# ---- 八、面团·胚料组(右键循环转换) ----
|
||||
{"block": "rtdd:dough_0", "item": None, "target": "rtdd:breaddough_1",
|
||||
"tip": "§a转成法棍面胚"},
|
||||
"startTimer": "rtdd:breaddough_1", "tip": "§a转成法棍面胚, 开始发酵(60秒)"},
|
||||
{"block": "rtdd:breaddough_1", "item": None, "target": "rtdd:breaddough_2",
|
||||
"tip": "§a转成吐司面胚"},
|
||||
{"block": "rtdd:breaddough_2", "item": None, "target": "rtdd:breaddough_4d",
|
||||
@@ -237,8 +249,8 @@ SWITCH_RULES = [
|
||||
"consume": 1, "tip": "§a做了奶油蛋糕"},
|
||||
{"block": "rtdd:cakebase", "item": HONEY, "target": "rtdd:cake_1",
|
||||
"consume": 1, "tip": "§a做了蜂蜜蛋糕"},
|
||||
{"block": "rtdd:cakebase", "item": BERRIES, "target": "rtdd:cake_2",
|
||||
"consume": 1, "tip": "§a做了浆果蛋糕"},
|
||||
{"block": "rtdd:cake_0", "item": BERRIES, "target": "rtdd:cake_2",
|
||||
"consume": 1, "tip": "§a奶油蛋糕加了浆果, 做成浆果蛋糕"},
|
||||
{"block": "rtdd:cake_1", "item": CLEAVER, "target": "rtdd:cake_1a",
|
||||
"dropItem": "rtdd:cake_1d", "tip": "§a切下小块"},
|
||||
{"block": "rtdd:cake_1a", "item": CLEAVER, "target": "rtdd:cake_1b",
|
||||
@@ -252,7 +264,7 @@ SWITCH_RULES = [
|
||||
{"block": "rtdd:cake_2b", "item": CLEAVER, "action": "split_cake",
|
||||
"dropItem": "rtdd:cake_2d", "tip": "§a半块切成两块小块"},
|
||||
{"block": "rtdd:plate_35", "item": SUGAR, "target": "rtdd:cream_caramel",
|
||||
"consume": 16, "tip": "§a做成焦糖布丁"},
|
||||
"consume": 16, "tip": "§a做成焦糖布丁(消耗16个糖)"},
|
||||
{"block": "rtdd:plate_34", "item": CREAM, "target": "rtdd:creampastry_0",
|
||||
"consume": 1, "tip": "§a做成舒芙蕾半成品"},
|
||||
]
|
||||
@@ -270,17 +282,39 @@ KNEAD_COUNTERS = {
|
||||
# ============================================================================
|
||||
# 四、手持物品右键方块表面规则 (itemUseOn)
|
||||
# 生面饼右键烤炉 -> 烤炉上方放置 馍; 面粉(加鸡蛋)右键木碗 -> 木碗变蛋糕面糊
|
||||
# 手持生食右键蒸笼 -> 蒸笼变"蒸X_生"(蒸笼需放在点燃的炉灶 stove_2 上)
|
||||
# ============================================================================
|
||||
ITEM_USE_ON_RULES = [
|
||||
{"item": "rtdd:dought_7", "surface": OVEN, "above": "rtdd:roujiamo_0",
|
||||
"consume": 1, "tip": "§a烙制成了馍"},
|
||||
{"item": "rtdd:farineblock_1", "surface": BOWL, "replace": "rtdd:cakebatterblock_0",
|
||||
"consume": 1, "tip": "§a木碗变成了蛋糕面糊(生)"},
|
||||
# ---- 蒸笼(下面要点燃的炉灶才计时) ----
|
||||
{"item": "rtdd:dumplings_4", "surface": STEAMER,
|
||||
"replace": "rtdd:steamerdumplings_0", "consume": 4,
|
||||
"startTimer": "rtdd:steamerdumplings_0",
|
||||
"needBelow": LIT_STOVE, "belowTip": "§c蒸笼需要放在点燃的炉灶上",
|
||||
"tip": "§a四个生饺子放进蒸笼, 开始蒸制"},
|
||||
{"item": "rtdd:roubaozi_3", "surface": STEAMER,
|
||||
"replace": "rtdd:baozilong_1", "consume": 3,
|
||||
"startTimer": "rtdd:baozilong_1",
|
||||
"needBelow": LIT_STOVE, "belowTip": "§c蒸笼需要放在点燃的炉灶上",
|
||||
"tip": "§a三个生肉包子放进蒸笼, 开始蒸制"},
|
||||
{"item": "rtdd:bamboo_4", "surface": STEAMER,
|
||||
"replace": "rtdd:bamboo_6", "consume": 1,
|
||||
"startTimer": "rtdd:bamboo_6",
|
||||
"needBelow": LIT_STOVE, "belowTip": "§c蒸笼需要放在点燃的炉灶上",
|
||||
"tip": "§a竹筒饭放进蒸笼, 开始蒸制"},
|
||||
{"item": "rtdd:plate_34", "surface": STEAMER,
|
||||
"replace": "rtdd:steamermilkandegg", "consume": 1,
|
||||
"startTimer": "rtdd:steamermilkandegg",
|
||||
"needBelow": LIT_STOVE, "belowTip": "§c蒸笼需要放在点燃的炉灶上",
|
||||
"tip": "§a蛋液半成品放进蒸笼, 开始蒸制"},
|
||||
]
|
||||
|
||||
# ============================================================================
|
||||
# 五、计时规则(供 MianshiTimerService)
|
||||
# below: 下方方块判定列表(烤炉/蒸笼); dropOnBreak: 下方方块被打碎时该方块掉落+提示
|
||||
# below: 下方方块判定列表(烤炉/点燃炉灶); dropOnBreak: 下方方块被打碎时该方块掉落+提示
|
||||
# ============================================================================
|
||||
TIMER_RULES = [
|
||||
# 发酵(60秒, autoStart)
|
||||
@@ -288,23 +322,16 @@ TIMER_RULES = [
|
||||
"autoStart": True, "doneTip": "§e面团发酵好了"},
|
||||
{"source": "rtdd:breaddough_1", "target": "rtdd:breaddough_1a", "time": 60,
|
||||
"autoStart": True, "doneTip": "§e法棍面胚发好了"},
|
||||
# 蒸笼: 食物放蒸笼上 -> 蒸食物块(1秒) / 蒸熟(60秒)
|
||||
{"source": "rtdd:dumplings_4", "target": "rtdd:steamerdumplings_0", "time": 1,
|
||||
"below": [STEAMER], "autoStart": True},
|
||||
{"source": "rtdd:roubaozi_3", "target": "rtdd:baozilong_1", "time": 1,
|
||||
"below": [STEAMER], "autoStart": True},
|
||||
{"source": "rtdd:bamboo_4", "target": "rtdd:bamboo_6", "time": 1,
|
||||
"below": [STEAMER], "autoStart": True},
|
||||
{"source": "rtdd:plate_34", "target": "rtdd:steamermilkandegg", "time": 1,
|
||||
"below": [STEAMER], "autoStart": True},
|
||||
# 蒸笼: 手持生食右键蒸笼 -> 蒸X_生(见 ITEM_USE_ON_RULES); 蒸X_生下方是
|
||||
# 点燃的炉灶(stove_2)才计时, 60秒蒸熟
|
||||
{"source": "rtdd:steamerdumplings_0", "target": "rtdd:steamerdumplings_1", "time": 60,
|
||||
"below": [STEAMER], "autoStart": True, "doneTip": "§e饺子蒸好了"},
|
||||
"below": [LIT_STOVE], "autoStart": True, "doneTip": "§e饺子蒸好了"},
|
||||
{"source": "rtdd:baozilong_1", "target": "rtdd:baozilong_2", "time": 60,
|
||||
"below": [STEAMER], "autoStart": True, "doneTip": "§e包子蒸好了"},
|
||||
"below": [LIT_STOVE], "autoStart": True, "doneTip": "§e包子蒸好了"},
|
||||
{"source": "rtdd:bamboo_6", "target": "rtdd:bamboo_7", "time": 60,
|
||||
"below": [STEAMER], "autoStart": True, "doneTip": "§e竹筒饭蒸好了"},
|
||||
"below": [LIT_STOVE], "autoStart": True, "doneTip": "§e竹筒饭蒸好了"},
|
||||
{"source": "rtdd:steamermilkandegg", "target": "rtdd:steamermilkandegg_1", "time": 60,
|
||||
"below": [STEAMER], "autoStart": True, "doneTip": "§e蒸牛奶鸡蛋好了"},
|
||||
"below": [LIT_STOVE], "autoStart": True, "doneTip": "§e蒸牛奶鸡蛋好了"},
|
||||
# 烤炉烘焙(60秒, 下方判定烤炉; 烤炉被打碎 -> 该方块掉落+提示)
|
||||
{"source": "rtdd:breaddough_1a", "target": "rtdd:bread_1", "time": 60,
|
||||
"below": [OVEN], "autoStart": True, "dropOnBreak": True, "doneTip": "§e法棍烤好了"},
|
||||
|
||||
+70
-15
@@ -35,9 +35,9 @@ from ....BlueFoxTools.ToolsConfig import LevelId
|
||||
|
||||
# ---- 只导入面食自己的数据库 ----
|
||||
from ..MianshiData import (
|
||||
CLEAVER, ROLLINGPIN, BOWL, OVEN,
|
||||
CLEAVER, ROLLINGPIN, BOWL, OVEN, STEAMER,
|
||||
MEAT_ITEMS, FILLING_ITEMS, RICH_MEAT_ITEMS,
|
||||
SWITCH_RULES, KNEAD_COUNTERS, ITEM_USE_ON_RULES,
|
||||
SWITCH_RULES, KNEAD_COUNTERS, ITEM_USE_ON_RULES, OVEN_FIX_BLOCKS,
|
||||
)
|
||||
|
||||
# ---- 统一分发器 ----
|
||||
@@ -75,6 +75,16 @@ class MianshiService(BlueFoxServerSystem):
|
||||
for b in KNEAD_COUNTERS:
|
||||
self.featureBlocks.add(b)
|
||||
|
||||
# 蒸笼也要登记为本服务管辖: 手持生食右键蒸笼(itemUseOn)时, 分发器
|
||||
# 要求当前服务在被点方块的归属列表里才放行(蒸笼已归 ChujuService 管辖)
|
||||
self.featureBlocks.add(STEAMER)
|
||||
|
||||
# 烤炉固定的方块全部登记右键路由(蛋糕面糊/可颂胚/舒芙蕾半成品/发面等
|
||||
# 不在 SWITCH_RULES 里), 否则右键它们时不会被分发器路由到本服务,
|
||||
# "烤炉固定 + 开始烤制提示"就不生效
|
||||
for b in OVEN_FIX_BLOCKS:
|
||||
self.featureBlocks.add(b)
|
||||
|
||||
# ---- itemUseOn 映射: 手持物品 -> 规则 ----
|
||||
self.itemUseOnMap = {}
|
||||
for r in ITEM_USE_ON_RULES:
|
||||
@@ -117,6 +127,13 @@ class MianshiService(BlueFoxServerSystem):
|
||||
if blockName in KNEAD_COUNTERS and (not itemName or itemName == "minecraft:air"):
|
||||
return self._handleKnead(blockName, playerId, pos, dim, key)
|
||||
|
||||
# ---- 烤炉固定: 胚/面糊/蛋液等放在烤炉上 -> 禁止右键转换, 固定开始烤制 ----
|
||||
if blockName in OVEN_FIX_BLOCKS and self._belowIs(dim, pos, OVEN):
|
||||
FeatureDispatcher.startTimerFor(blockName, dim, pos, playerId)
|
||||
if self.checkCooldown(key, 0.4):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, "§a开始烤制…(60秒)")
|
||||
return True
|
||||
|
||||
# ---- 常规转换 ----
|
||||
recipe = self.findRecipe(blockName, itemDict)
|
||||
if not recipe:
|
||||
@@ -130,6 +147,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
"""由 FeatureDispatcher 转发的"手持物品右键方块表面"入口:
|
||||
1) 手持 生面饼 右键 烤炉 -> 烤炉上方放置 馍(烙制), 消耗1个生面饼
|
||||
2) 手持 面粉(加鸡蛋) 右键 木碗 -> 木碗变 蛋糕面糊(生), 消耗1个
|
||||
3) 手持 生食 右键 蒸笼 -> 蒸笼变 蒸X_生(蒸笼下要点燃的炉灶, 消耗1个)
|
||||
返回 True=处理了; False=不属本功能管(交还默认行为)。"""
|
||||
itemName = args.get("itemName")
|
||||
playerId = args.get("playerId") or args.get("entityId")
|
||||
@@ -148,13 +166,25 @@ class MianshiService(BlueFoxServerSystem):
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# 需要下方方块(如蒸笼下要点燃的炉灶): 不满足则提示并拦截, 不消耗物品
|
||||
needBelow = rule.get("needBelow")
|
||||
if needBelow and not self._belowIs(dim, (x, y, z), needBelow):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, rule.get("belowTip", "§c下方方块不符合"))
|
||||
return True
|
||||
|
||||
if not self.checkCooldown((dim, x, y, z), 0.4):
|
||||
return True
|
||||
|
||||
itemDict = self.getCarriedItem(playerId)
|
||||
if not itemDict:
|
||||
return False
|
||||
self.consumeItem(playerId, itemDict, rule.get("consume", 1))
|
||||
consume = rule.get("consume", 1)
|
||||
if consume > 1 and (itemDict.get("count") or 0) < consume:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§c数量不足, 需要 %d 个" % consume)
|
||||
return True
|
||||
self.consumeItem(playerId, itemDict, consume)
|
||||
|
||||
if rule.get("above"):
|
||||
# 在表面方块上方放置结果(烙制)
|
||||
@@ -168,9 +198,14 @@ class MianshiService(BlueFoxServerSystem):
|
||||
pass
|
||||
self.replaceBlock(targetPos, dim, rule["above"], playerId)
|
||||
elif rule.get("replace"):
|
||||
# 表面方块本身被替换(木碗变蛋糕面糊)
|
||||
# 表面方块本身被替换(木碗变蛋糕面糊/蒸笼变蒸X_生)
|
||||
self.replaceBlock((x, y, z), dim, rule["replace"], playerId)
|
||||
|
||||
# 替换/放置后立刻启动计时(记录发起玩家, 蒸熟完成/暂停提示能送达)
|
||||
if rule.get("startTimer"):
|
||||
FeatureDispatcher.startTimerFor(
|
||||
rule["startTimer"], dim, (x, y, z), playerId)
|
||||
|
||||
if rule.get("tip"):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, rule["tip"])
|
||||
return True
|
||||
@@ -211,9 +246,14 @@ class MianshiService(BlueFoxServerSystem):
|
||||
# ============================================================================
|
||||
|
||||
def handleSwitch(self, recipe, playerId, pos, dim, itemDict):
|
||||
# 消耗物品
|
||||
if recipe.get("consume", 0) > 0:
|
||||
self.consumeItem(playerId, itemDict, recipe["consume"])
|
||||
# 消耗物品(数量不足则拦截, 不转换)
|
||||
consume = recipe.get("consume", 0)
|
||||
if consume > 1 and itemDict is not None and (itemDict.get("count") or 0) < consume:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§c数量不足, 需要 %d 个" % consume)
|
||||
return
|
||||
if consume > 0:
|
||||
self.consumeItem(playerId, itemDict, consume)
|
||||
# 替换方块
|
||||
if recipe.get("target"):
|
||||
self.replaceBlock(pos, dim, recipe["target"], playerId)
|
||||
@@ -243,16 +283,31 @@ class MianshiService(BlueFoxServerSystem):
|
||||
for _ in range(2):
|
||||
self.dropItem(dim, pos, recipe["dropItem"])
|
||||
elif action == "take_steamer":
|
||||
# 蒸笼取出: 蒸食物块 -> 变回空蒸笼 + 掉落成品
|
||||
# 蒸笼取出: 蒸食物块 -> 变回空蒸笼 + 掉落成品(数量按 dropCount, 默认1)
|
||||
self.replaceBlock(pos, dim, "rtdd:steamer", playerId)
|
||||
if recipe.get("dropItem"):
|
||||
self.dropItem(dim, pos, recipe["dropItem"])
|
||||
for _ in range(recipe.get("dropCount", 1)):
|
||||
self.dropItem(dim, pos, recipe["dropItem"])
|
||||
# 转换后启动计时(发酵等, 记录玩家以便完成提示送达)
|
||||
if recipe.get("startTimer"):
|
||||
FeatureDispatcher.startTimerFor(recipe["startTimer"], dim, pos, playerId)
|
||||
# 提示
|
||||
if recipe.get("tip"):
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, recipe["tip"])
|
||||
|
||||
# ============================================================================
|
||||
# 五、工具方法:获取玩家主手物品
|
||||
# 五、工具方法:判断正下方是否指定方块(烤炉/点燃炉灶)
|
||||
# ============================================================================
|
||||
|
||||
def _belowIs(self, dim, pos, blockName):
|
||||
try:
|
||||
b = comp.CreateBlockInfo(LevelId).GetBlockNew((pos[0], pos[1] - 1, pos[2]), dim)
|
||||
return bool(b) and b.get("name") == blockName
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# ============================================================================
|
||||
# 六、工具方法:获取玩家主手物品
|
||||
# ============================================================================
|
||||
|
||||
def getCarriedItem(self, playerId):
|
||||
@@ -261,7 +316,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
serverApi.GetMinecraftEnum().ItemPosType.CARRIED, 0, True)
|
||||
|
||||
# ============================================================================
|
||||
# 六、工具方法:给玩家物品
|
||||
# 七、工具方法:给玩家物品
|
||||
# ============================================================================
|
||||
|
||||
def giveItem(self, playerId, itemName, count=1, aux=0):
|
||||
@@ -272,7 +327,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
pass
|
||||
|
||||
# ============================================================================
|
||||
# 七、工具方法:消耗物品
|
||||
# 八、工具方法:消耗物品
|
||||
# ============================================================================
|
||||
|
||||
def consumeItem(self, playerId, itemDict, amount=1):
|
||||
@@ -293,7 +348,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
"userData": itemDict.get("userData", {})})
|
||||
|
||||
# ============================================================================
|
||||
# 八、工具方法:以掉落物形式生成物品
|
||||
# 九、工具方法:以掉落物形式生成物品
|
||||
# ============================================================================
|
||||
|
||||
def dropItem(self, dim, pos, itemName, count=1, aux=0):
|
||||
@@ -304,7 +359,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
pass
|
||||
|
||||
# ============================================================================
|
||||
# 九、工具方法:替换方块 / 清空方块(保留 aux, 兼容定向变体)
|
||||
# 十、工具方法:替换方块 / 清空方块(保留 aux, 兼容定向变体)
|
||||
# ============================================================================
|
||||
|
||||
def replaceBlock(self, pos, dim, newBlockName, playerId=None):
|
||||
@@ -325,7 +380,7 @@ class MianshiService(BlueFoxServerSystem):
|
||||
oldBlockHandling=0, dimensionId=dim)
|
||||
|
||||
# ============================================================================
|
||||
# 十、工具方法:冷却检查
|
||||
# 十一、工具方法:冷却检查
|
||||
# ============================================================================
|
||||
|
||||
def checkCooldown(self, key, cd=0.4):
|
||||
|
||||
+3
-1
@@ -162,7 +162,9 @@ class MianshiTimerService(BlueFoxServerSystem):
|
||||
rule = r
|
||||
break
|
||||
if rule is None:
|
||||
return # 蒸笼等: 暂停
|
||||
# 蒸笼等: 暂停计时(数据保留, 炉灶回来继续) + 提示发起玩家
|
||||
self._notifyIfOnline(data.get("rtdd_tp"), "§c蒸笼下的炉灶移走了, 暂停蒸制")
|
||||
return
|
||||
# 烤炉被打碎: 方块掉落 + 变空气 + 终止计时 + 提示
|
||||
self._clearTimerData(dim, pos)
|
||||
self._dropBlockItem(dim, pos, blockName)
|
||||
|
||||
Reference in new issue
Block a user