Fix blueprint integrity & build behavior, improve structure scanner interaction 修复蓝图完整性与建造行为并完善结构扫描器交互 - #4962
Conversation
- 统一扫描、导入和旧磁盘的蓝图规范化,补全多方块部件并清理孤立部件及无源流体 - 校验部件重叠、移动活塞和尺寸超限,统一保存、预览、展示物识别与部署的数据 - 抑制蓝图静默建造期间的邻居更新、方块事件和计划刻,避免恢复方块实体时触发间接更新 - 按实际可用液体源过滤部分建造中的流动液体,避免缺少源头时生成孤立流体 - 修正粉碎台、筛网和拆包台的建造材料,支持从容器或掉落物消耗冲压平台与升级材料,并在放置失败时返还 - 为结构扫描器添加滚轮调节范围和界面状态提示,显示导入修复统计及文件操作错误 - 统一扫描范围与边框计算,仅在持有或佩戴铁砧锤时显示扫描范围 - 修正巨型铁砧落点坐标,统一碰撞边距计算
Reason: script execution via -e/-c flag Reply |
Reason: script execution via -e/-c flag Reply |
Reason: script execution via -e/-c flag Reply |
Reason: recursive delete Reply |
Reason: Security scan — [MEDIUM] Archive extraction to sensitive path: Archive command 'unzip' extracts to a potentially sensitive location Reply |
Reason: Security scan — [HIGH] Pipe to interpreter: curl | python3: Command pipes output from 'curl' directly to interpreter 'python3'. Downloaded content will be executed without inspection. Reply |
|
(action = |
代码审查摘要 — PR #4962操作: opened( 🔴 关键(需修复后再合并)1. // StructureScannerActionPacket.java:118-122 —— 无 try/catch
String structureName = name.isEmpty() ? "structure_" + System.currentTimeMillis() : name;
dev.dubhe.anvilcraft.util.StructureSaveUtil.saveStructureToDisk(player.level(), blockEntity, structureName);调用链:
建议:与同分支的 try {
StructureSaveUtil.saveStructureToDisk(...);
} catch (IOException | IllegalArgumentException e) {
PacketDistributor.sendToPlayer(serverPlayer, new StructureScannerStatusPacket(menu.containerId,
Component.translatable("screen.anvilcraft.structure_scanner.file_failed", e.getMessage())));
}
|
| 声称 | 状态 | 对应文件/证据 |
|---|---|---|
| 统一扫描/导入/旧磁盘归一化,补全部件+清理孤立部件 | ✅ | BlueprintNormalizer(shouldRecord 驱动重展开,sameFamily+repair 保留部件族与结构性属性) |
| 清理无源流体 | ✅ | BlueprintFluids.reachable + normalize 的 removeIf(#4956 场景自洽) |
| 校验部件重叠 / 移动活塞 / 尺寸超限 | ✅ | 三处 IllegalArgumentException(但见 🔴 调用方漏 catch) |
| 统一保存、预览、展示物识别、部署的数据 | ✅ | StructureSaveUtil.buildSnapshot 成为唯一入口,DiskDisplaySupport.getImportedDisplay/StructureLoadUtil/BuildingRodService 全走归一化快照 |
| 静默建造期间抑制邻居更新/方块事件/计划刻 | ✅ | 3 个新 mixin + BuildingCommit.quietly(目标方法已用 mappings 核实) |
| 按实际可用液体源过滤部分建造的流动液体 | ✅ | commit(..., declared) 的 prune(有保守边界,见 |
| 修正粉碎台/筛网/拆包台建造材料,支持容器或掉落物消耗,失败返还 | ✅ | ProcessingTablePlacement + 两个 pointer + BuildingBlockMaterial.baseMaterial + ModBlockPlacementRuleProvider + 3 个新规则 JSON(#4960) |
| 滚轮调节范围 / 界面状态提示 / 导入修复统计 / 文件错误 | ✅ | RangeValue、StructureScannerStatusPacket、added/removed tag、showStatus(消息回退见 |
| 统一扫描范围与边框计算,仅持锤/戴锤显示 | ✅ | getScanBounds() + hasScannerHammer(#4961) |
| 修正巨型铁砧落点坐标、统一碰撞边距 | ✅ | FallingGiantAnvilEntity(#4961 相关) |
| fixed #4956 / #4961 / #4960 | ✅ | 三个 issue 均 open 且 assignee = WhereisFff,标题与本 PR 修改点一一对应 |
🧪 测试建议
| 被测目标 | 推荐场景 | 优先级 |
|---|---|---|
StructureScannerActionPacket confirm 路径 |
扫描时让活塞动作 → 点保存:应出界面错误提示、不抛异常 | 🔴 |
BlueprintNormalizer.normalize |
移动活塞 / 部件重叠 / 16 格越界部件 → 三条消息正确、导入与自动保存都被 catch | 🔴 |
ProcessingTablePlacement.placeFrom* |
容器只有冲压平台无升级件、升级件槽位被占、放置目标被阻挡、掉落物只剩 1 个 → 材料必须全额返还 | 🔴 |
| 扫描预览坐标映射 | 扫描器朝 N/S/W/E × 正/倒置,含门、床、多方块、活塞:GUI 预览与 getScanBounds 边框必须与框内实际一致 |
🟡 |
commit 流动液体过滤 |
蓝图边缘贴着已存在水池、蓝图自带水源层(#4956 复现)、部分建造(partial) | 🟡 |
| 旧磁盘/旧扫描缓存兼容 | 用更新前的 .nbt 与 BE 内已持久化的 scannedBlocks 载入:部件应被补全、孤立部件被清理、部署结果与保存前一致 |
🟡 |
| 滚轮调节 | 三个 range 输入框滚轮 / 下拉列表滚轮 / 文本框滚轮不互相抢事件,边界(0 与最大)夹紧 | 🟢 |
| 撤销(Undo) | 静默蓝图提交后整体撤销:被 mixin 改道的 setBlock 也必须还原 | 🟢 |
结论: REQUEST_CHANGES — 设计与实现质量整体很高(归一化收敛、静默建造、材料/返还、mixin 目标与滚轮派发都已核实无误),但问题 1 是新增校验直接打到玩家主操作路径上的漏 catch,异常会穿出 packet handler,属于合并前应修的一处;其余为警告与建议。
|
代码审查摘要 — PR #4962操作: opened(处理 ✅ 已实测/交叉核实的关键点
🔴 关键未发现阻塞性问题(无崩溃/重复扣费/存档破坏级缺陷)。
|
| 声称 | 状态 | 对应实现 |
|---|---|---|
| 统一扫描/导入/旧磁盘规范化,补全部件 + 清理孤立部件与无源流体 | ✅ | BlueprintNormalizer, BlueprintMultiblocks, BlueprintFluids, StructureSaveUtil.buildSnapshot, StructureLoadUtil:82, BuildingRodClient:165, DiskDisplaySupport:117 |
| 校验部件重叠、移动活塞、尺寸超限;统一保存/预览/展示物/部署 | ✅ | BlueprintNormalizer:55/68/94、StructureSaveUtil:110-123、BlueprintNormalizer.load(含 32 条缓存) |
| 抑制静默建造期的邻居更新、方块事件、计划刻 | ✅ | BuildingCommit.quietly + BlueprintLevelMixin / BlueprintServerLevelMixin / BlueprintTicksMixin,BuildingRodService:666 包裹 place |
| 按实际可用液体源过滤部分建造中的流动液体 | BuildingRodService:570-583(逻辑正确,但材料已在预留后仍被扣费,见 W1) |
|
| 修正加工台建造材料;支持容器/掉落物两路消耗冲压平台+升级材料并失败返还 | ✅ | ProcessingTablePlacement、BlockItemHandlerPointer:83-124、ItemEntityPointer:104-138、ModBlockPlacementRuleProvider.addBlockRules 早退分支 + 3 张新 JSON、UseItemOnBlock.materialFor 转 public |
| 扫描器滚轮调范围 + 界面状态提示(导入统计/文件错误) | ✅ / |
StructureScannerScreen.RangeValue:266-283、showStatus/renderLabels:515-535、StructureScannerStatusPacket、BlueprintClientFiles.receive(提示丢失风险见 W2) |
| 统一扫描范围与边框计算,仅持/戴铁砧锤时显示 | StructureScannerBlockEntity.getScanBounds + RenderEventListener 共用(覆盖 goggleMode 语义,见 W5) |
|
| 修正巨型铁砧落点坐标,统一碰撞边距 | ✅ | FallingGiantAnvilEntity(COLLISION_MARGIN 单一定义 + 落点格与 deflate 包围盒对齐) |
| fixed #4956 / #4961 / #4960 | ⚪ | 本次未能独立核实 issue 正文(gh 未认证,未访问 issue API);上述 diff 内容与三条描述的核心症状一致 |
结论: COMMENT — 架构收敛方向正确(三处互不相同的蓝图解析/规范化路径合并为一个入口),Mixin 注入点与坐标变换均已逐项验证无误,无阻塞性问题。建议合并前先处理 W1(丢弃液体格仍扣材料)与 W2(关屏后提示丢失),其余为可选打磨。
🧪 测试建议
| 被测目标 | 推荐场景 | 优先级 |
|---|---|---|
BlueprintNormalizer.normalize |
幂等性:save→load→save 字节等价;16³ 边界(部件刚好越界);移动活塞/重叠部件必须抛异常 |
🔴 |
BlueprintMultiblocks.forEachPart |
门/床/高草在扫描框边缘(上半在框外)、活塞头、多部件核心 | 🔴 |
BlueprintFluids.reachable |
源在框内/框外、水瀑布中段、含水台阶(waterlogged 碰撞形状)遮挡 | 🔴 |
BuildingRodService.commit |
部分建造:源格未放置时下游流动被丢弃,且材料数必须等于实际放置数(W1 回归) | 🔴 |
BuildingCommit.quietly + 三个 Mixin |
嵌套调用时 ThreadLocal 正确恢复;提交结束后邻居更新/计划刻恢复正常;客户端邻居更新不触发 CCE | 🟡 |
ProcessingTablePlacement |
放置失败(目标被占)时容器/掉落物材料完整返还;upgradeSlot 与基础材料同槽不同槽;堆叠 >1 时只扣 1 |
🟡 |
StructureSaveUtil.saveStructureToDisk / 旧磁盘 |
旧格式(真实朝向 + 预览帧)与新格式(NORTH + 规范帧)在扫描器预览、磁盘展示物、智能方块放置器上的朝向一致 | 🟡 |
由 Hermes Agent 审查
|
💾 Self-improvement review: Patched SKILL.md in skill 'building-rod-blueprint-review' (1 replacement). · Patched SKILL.md in skill 'mixin-injection-verification' (1 replacement). |
|
|
|
💾 Self-improvement review: Patched references/blueprint-normalization-and-quiet-build-review.md in skill 'building-rod-blueprint-review' (1 replacement). · Patched SKILL.md in skill 'mixin-injection-verification' (1 replacement). |
|
I reached the maximum iterations (90) but couldn't summarize. Error: <title>504 Gateway Time-out</title>504 Gateway Time-outopenresty |
|
💾 Self-improvement review: Patched SKILL.md in skill 'mixin-injection-verification' (1 replacement). · Patched references/blueprint-normalization-and-quiet-build-review.md in skill 'building-rod-blueprint-review' (1 replacement). · Patched SKILL.md in skill 'building-rod-blueprint-review' (1 replacement). |
Uh oh!
There was an error while loading. Please reload this page.