kill杀死不生成尸体(可用版本)

This commit is contained in:
wenhe committed 2026-09-24 15:35:27 +08:00
1 parent 11ed9214ce
commit 23598ed3dd
5 files changed
+125 -8

No files matched your search

@@ -46,7 +46,8 @@ from ..ChujuData import (
STOVE_RULES, MEATBALLMAKER_RULES, MEATBALL_TIMERS,
MEAT_ITEMS, MILK_ITEM, BUCKET_ITEM, EGG_ITEM,
BOWL_ITEM, PLATE_ITEM, CREAM_ITEM, EGG_CUSTARD_ITEM, BEATER_BLOCKS,
SOYBEAN_ITEM, SOYBEAN_COUNT, STONEMILL_GRIND_COUNT,
SOYBEAN_ITEM, SOYBEAN_COUNT, WHEAT_ITEM, WHEAT_COUNT,
FLOUR_ITEM, STONEMILL_GRIND_COUNT, STONEMILL_MATERIAL_KEY,
GLASS_TANK_ITEM, OIL_CAN_ITEM, STEAMER_RULES,
SPATULA, SPATULA_OIL, WOK, OIL_PAN, OIL_CAN_USES,
)
@@ -541,14 +542,17 @@ class ChujuService(BlueFoxServerSystem):
playerId = args.get("playerId")
x, y, z = args.get("x"), args.get("y"), args.get("z")
dim = comp.CreateDimension(playerId).GetEntityDimensionId()
# 读取研磨进度;None 或 <0(已清豆/-1) = 空石磨
# 读取研磨进度与材料;None 或 <0(已清豆/-1) = 空石磨
prog = self._readMill((x, y, z), dim)
if prog is None or prog < 0:
return False
# 有黄豆:额外掉落16个(石磨本体由默认破坏掉落)
mat = self._readMillMat((x, y, z), dim) or "soybean"
ret = FLOUR_ITEM if mat == "wheat" else SOYBEAN_ITEM
count = WHEAT_COUNT if mat == "wheat" else SOYBEAN_COUNT
# 有材料:额外掉落对应原料(石磨本体由默认破坏掉落)
try:
self.CreateEngineItemEntity(
{"itemName": SOYBEAN_ITEM, "count": SOYBEAN_COUNT, "auxValue": 0},
{"itemName": ret, "count": count, "auxValue": 0},
dim, (x, y + 0.5, z))
except Exception:
pass
@@ -556,9 +560,23 @@ class ChujuService(BlueFoxServerSystem):
def _handleStonemill(self, playerId, pos, dim, itemDict, itemName, key):
prog = self._readMill(pos, dim) # None=空, 0~3=研磨中, 4=完成
mat = self._readMillMat(pos, dim) or "soybean" # 默认黄豆; 'wheat'=小麦
# ---- 空石磨 + 黄豆(16) -> 加入黄豆 ----
# ---- 空石磨 + 黄豆(16) 或 小麦(6) -> 加入 ----
if prog is None:
if itemName == WHEAT_ITEM:
if (itemDict.get("count") or 0) < WHEAT_COUNT:
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§c需要 %d 个小麦" % WHEAT_COUNT)
return True
if not self.checkCooldown(key, 0.5):
return True
self.consumeItem(playerId, itemDict, WHEAT_COUNT)
self._writeMillMat(dim, pos, "wheat")
self._writeMill(dim, pos, 0)
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a加入小麦,空手右键研磨")
return True
if itemName == SOYBEAN_ITEM:
if (itemDict.get("count") or 0) < SOYBEAN_COUNT:
comp.CreateMsg(playerId).NotifyOneMessage(
@@ -567,6 +585,7 @@ class ChujuService(BlueFoxServerSystem):
if not self.checkCooldown(key, 0.5):
return True
self.consumeItem(playerId, itemDict, SOYBEAN_COUNT)
self._writeMillMat(dim, pos, "soybean")
self._writeMill(dim, pos, 0)
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a加入黄豆,空手右键研磨")
@@ -583,15 +602,28 @@ class ChujuService(BlueFoxServerSystem):
self._rotateMill(pos, dim)
self._writeMill(dim, pos, newProg)
if newProg >= STONEMILL_GRIND_COUNT:
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a研磨完成,可加玻璃罐取油")
tip = "§a研磨完成,可空手取出 面粉" if mat == "wheat" \
else "§a研磨完成,可加玻璃罐取油"
comp.CreateMsg(playerId).NotifyOneMessage(playerId, tip)
else:
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a研磨中,(%d/%d)" % (newProg, STONEMILL_GRIND_COUNT))
return True
# ---- 完成: + 玻璃罐 -> 油罐 ----
# ---- 完成 ----
if prog >= STONEMILL_GRIND_COUNT:
if mat == "wheat":
# 小麦已磨成面粉: 空手右键 -> 掉落 1 面粉 + 还原空
if itemName and itemName != "minecraft:air":
return False
if not self.checkCooldown(key, 0.5):
return True
self.dropItems(dim, pos, [{"name": FLOUR_ITEM, "count": 1}])
self._clearMill(dim, pos)
comp.CreateMsg(playerId).NotifyOneMessage(
playerId, "§a取出了面粉")
return True
# 黄豆: + 玻璃罐 -> 油罐
if itemName == GLASS_TANK_ITEM:
if not self.checkCooldown(key, 0.5):
return True
@@ -666,11 +698,40 @@ class ChujuService(BlueFoxServerSystem):
except Exception:
return None
def _writeMillMat(self, dim, pos, mat):
"""写入石磨材料标识('soybean'/'wheat')"""
try:
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
if data is None:
gameComp.AddTimer(0.1, self._writeMillMatDelayed, dim, pos, mat)
return
data[STONEMILL_MATERIAL_KEY] = str(mat)
except Exception:
gameComp.AddTimer(0.1, self._writeMillMatDelayed, dim, pos, mat)
def _writeMillMatDelayed(self, dim, pos, mat):
try:
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
if data is not None:
data[STONEMILL_MATERIAL_KEY] = str(mat)
except Exception:
pass
def _readMillMat(self, pos, dim):
try:
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
if data is None:
return None
return data[STONEMILL_MATERIAL_KEY]
except Exception:
return None
def _clearMill(self, dim, pos):
try:
data = blockEntityDataComp.GetBlockEntityData(dim, pos)
if data is not None:
data["rtdd_mill"] = -1
data[STONEMILL_MATERIAL_KEY] = None
except Exception:
pass