提供物品放置方块功能

This commit is contained in:
Giao committed 2026-10-06 16:18:20 +08:00
1 parent e65cebaec1
commit 43c1859aad
8 files changed
+190 -6

No files matched your search

@@ -619,7 +619,7 @@ SWITCH_RULES = [
# 盖饭转换清单(正向+反向共用): dish=成品菜, target=盖饭
GAI_FAN_ITEMS = [
{"dish": PLATE_47, "target": PLATE_48,
{"dish": PLATE_47, "target": PLATE_48, "giveItem": PLATE_48,
"name": "辣子鸡丁", "gaiName": "辣子鸡丁盖饭(全份)"},
{"dish": PLATE_54, "target": PLATE_55,
"name": "香菇滑鸡", "gaiName": "香菇滑鸡盖饭(全份)"},
@@ -635,16 +635,17 @@ for _g in GAI_FAN_ITEMS:
_target = _g["target"]
_name = _g["name"]
_gai = _g["gaiName"]
_give = _g.get("giveItem") # 给定则"被点方块消失 + 给玩家物品", 否则原位替换成 target 方块
# 正向: 手持成品菜 右键 米饭(三形态任一) -> 米饭变盖饭
for _rice in RICE_FORMS:
ITEM_USE_ON_RULES.append({
"item": _dish, "surface": _rice, "target": _target, "consume": 1,
"tip": None})
"giveItem": _give, "tip": None})
# 反向: 手持 米饭(三形态任一) 右键 成品菜 -> 菜品变盖饭
for _rice in RICE_FORMS:
ITEM_USE_ON_RULES.append({
"item": _rice, "surface": _dish, "target": _target, "consume": 1,
"tip": None})
"giveItem": _give, "tip": None})
# 蛋炒饭 加米饭(形态1/2/3都行) -> 炒锅_87(蛋炒饭_加米饭_熟)
for _rice in RICE_FORMS:
ITEM_USE_ON_RULES.append({
@@ -198,7 +198,13 @@ class ChaoguoService(BlueFoxServerSystem):
self.consumeItem(playerId, itemDict, consume)
# 替换被右键的表面方块(米饭变盖饭 / 菜品变盖饭 / 蛋炒饭变熟)
self.replaceBlock(pos, dim, recipe["target"], playerId)
# giveItem: 新成品菜体系 —— 被点方块消失, 改为给玩家"成品菜物品"(可再放置出对应方块)
giveItem = recipe.get("giveItem")
if giveItem:
self.replaceBlock(pos, dim, "minecraft:air", playerId)
self.giveItemToPlayer(playerId, giveItem, 1, pos, dim)
else:
self.replaceBlock(pos, dim, recipe["target"], playerId)
self._clearWokData(dim, pos)
return True