修改菜谱 2

This commit is contained in:
wenhe committed 2026-08-06 15:37:15 +08:00
1 parent 11e9780dd4
commit 8372b14dbd
3 files changed
+5 -35

No files matched your search

@@ -722,10 +722,9 @@ BLOCK_SWITCHES = [
"type": "switch", "type": "switch",
"giveItem": "minecraft:water_bucket", "giveItem": "minecraft:water_bucket",
}, },
# ---- 放脏盘子 ---- # 【放第一个脏盘子 有水放盘子】水槽_1 → 水槽_2
# 【放第一个脏盘子】水槽_0 → 水槽_2
{ {
"source": "rtdd:flume_0", "source": "rtdd:flume_1",
"item": "rtdd:plate_0a", "item": "rtdd:plate_0a",
"target": "rtdd:flume_2", "target": "rtdd:flume_2",
"consume": 1, "consume": 1,
@@ -429,27 +429,12 @@ class BlockSwitchService(BlueFoxServerSystem):
""" """
try: try:
blockData = blockEntityDataComp.GetBlockEntityData(dim, pos) blockData = blockEntityDataComp.GetBlockEntityData(dim, pos)
print "[BlockSwitchService] _writeBlockData GetBlockEntityData returned: %s (pos=%s dim=%s)" % (type(blockData).__name__ if blockData is not None else "None", pos, dim)
if blockData is None: if blockData is None:
print "[BlockSwitchService] _writeBlockData blockData is None: pos=%s dim=%s" % (pos, dim)
return return
for key, value in kwargs.items(): for key, value in kwargs.items():
print "[BlockSwitchService] _writeBlockData setting: [%s]=%s (type=%s)" % (key, value, type(value).__name__)
blockData[key] = value blockData[key] = value
# 写入后立即读取验证
verifyData = blockEntityDataComp.GetBlockEntityData(dim, pos)
if verifyData:
for key in kwargs:
try:
val = verifyData[key]
print "[BlockSwitchService] _writeBlockData verify: [%s]=%s" % (key, val)
except:
print "[BlockSwitchService] _writeBlockData verify: [%s]=<KEY_ERROR>" % key
else:
print "[BlockSwitchService] _writeBlockData verify FAILED: blockData is None after write!"
except Exception as e: except Exception as e:
import traceback pass
print "[BlockSwitchService] _writeBlockData 写入失败: pos=%s dim=%s err=%s trace=%s" % (pos, dim, str(e), traceback.format_exc())
def _saveRecord(self, key, playerId, pos, dim, record): def _saveRecord(self, key, playerId, pos, dim, record):
""" """
@@ -489,7 +474,6 @@ class BlockSwitchService(BlueFoxServerSystem):
记录存在方块实体数据里,所以玩家退出游戏再重进, 记录存在方块实体数据里,所以玩家退出游戏再重进,
loadSwitchRecord 还能从方块里把物品读回来。 loadSwitchRecord 还能从方块里把物品读回来。
""" """
print "[BlockSwitchService] saveSwitchRecord pos=%s dim=%s record=%s" % (pos, dim, record)
if "count" in record: if "count" in record:
self._writeBlockData(dim, pos, self._writeBlockData(dim, pos,
rtdd_swt="count", rtdd_swt="count",
@@ -511,14 +495,9 @@ class BlockSwitchService(BlueFoxServerSystem):
""" """
try: try:
blockData = blockEntityDataComp.GetBlockEntityData(dim, pos) blockData = blockEntityDataComp.GetBlockEntityData(dim, pos)
print "[BlockSwitchService] loadSwitchRecord GetBlockEntityData returned: %s (pos=%s dim=%s)" % (type(blockData).__name__ if blockData is not None else "None", pos, dim)
if blockData is None: if blockData is None:
print "[BlockSwitchService] loadSwitchRecord blockData is None!"
return None return None
# 注意:BlockEntityData 对象不支持 .keys() 和 .get() 方法 swt = blockData["rtdd_swt"]
# 只支持 [] 操作符(__getitem__),key 不存在会抛 KeyError
swt = blockData["rtdd_swt"] # 记录类型:"count" 或 "stack"
print "[BlockSwitchService] loadSwitchRecord rtdd_swt=%s" % swt
if swt == "count": if swt == "count":
count = blockData["rtdd_swc"] count = blockData["rtdd_swc"]
itemName = blockData["rtdd_swi"] itemName = blockData["rtdd_swi"]
@@ -526,7 +505,6 @@ class BlockSwitchService(BlueFoxServerSystem):
auxValue = blockData["rtdd_swa"] auxValue = blockData["rtdd_swa"]
except (KeyError, Exception): except (KeyError, Exception):
auxValue = 0 auxValue = 0
print "[BlockSwitchService] loadSwitchRecord count data: count=%s itemName=%s auxValue=%s" % (count, itemName, auxValue)
return { return {
"count": count, "count": count,
"itemName": itemName, "itemName": itemName,
@@ -534,16 +512,12 @@ class BlockSwitchService(BlueFoxServerSystem):
} }
elif swt == "stack": elif swt == "stack":
stack = blockData["rtdd_sws"] stack = blockData["rtdd_sws"]
print "[BlockSwitchService] loadSwitchRecord stack data: len=%s" % len(stack)
return { return {
"stack": stack, "stack": stack,
} }
else: else:
print "[BlockSwitchService] loadSwitchRecord unknown swt: %s" % swt
return None return None
except Exception as e: except Exception as e:
import traceback
print "[BlockSwitchService] loadSwitchRecord exception: %s trace=%s" % (str(e), traceback.format_exc())
return None return None
def clearSwitchRecord(self, key, playerId, pos, dim): def clearSwitchRecord(self, key, playerId, pos, dim):
@@ -676,7 +650,6 @@ class BlockSwitchService(BlueFoxServerSystem):
先更新内存,再延迟写入方块实体。 先更新内存,再延迟写入方块实体。
""" """
print "[BlockSwitchService] _saveRecordDelayed key=%s record=%s" % (key, record)
self.switchRecord[key] = record self.switchRecord[key] = record
gameComp.AddTimer(0.1, self.saveSwitchRecord, playerId, pos, dim, record) gameComp.AddTimer(0.1, self.saveSwitchRecord, playerId, pos, dim, record)
@@ -684,7 +657,6 @@ class BlockSwitchService(BlueFoxServerSystem):
""" """
延迟一帧清除方块实体数据。 延迟一帧清除方块实体数据。
""" """
print "[BlockSwitchService] _clearRecordDelayed key=%s" % (key,)
self.switchRecord.pop(key, None) self.switchRecord.pop(key, None)
gameComp.AddTimer(0.1, self._clearRecordWrite, playerId, pos, dim) gameComp.AddTimer(0.1, self._clearRecordWrite, playerId, pos, dim)
@@ -652,12 +652,11 @@ class CookingService(BlueFoxServerSystem):
try: try:
blockData = blockEntityDataComp.GetBlockEntityData(dim, pos) blockData = blockEntityDataComp.GetBlockEntityData(dim, pos)
if blockData is None: if blockData is None:
print "[CookingService] _writeBlockData blockData is None: pos=%s dim=%s" % (pos, dim)
return return
for key, value in kwargs.items(): for key, value in kwargs.items():
blockData[key] = value blockData[key] = value
except Exception as e: except Exception as e:
print "[CookingService] _writeBlockData 写入失败: pos=%s dim=%s err=%s" % (pos, dim, str(e)) pass
# ============================================================================ # ============================================================================
# 统一数据加载入口(玩家右键方块时先把方块数据恢复到内存) # 统一数据加载入口(玩家右键方块时先把方块数据恢复到内存)