### Describe the bug 使用 Lua 脚本监听 `onAttackEntity` 和 `onMobHurt`,尝试阻止玩家对盔甲架造成破坏。 测试发现: - 剑攻击盔甲架时,`onAttackEntity` 正常触发,回调返回 `false` 可以阻止破坏。 - 长矛攻击盔甲架时,下面复现代码中的两个盔甲架诊断分支均无日志输出,盔甲架直接被破坏。 - 目前已知,长矛攻击其他实体可以被阻止,但偏偏攻击盔甲架无法被阻止 ### To Reproduce ```lua mc.listen("onAttackEntity", function(player, entity) if entity == nil or entity.type ~= "minecraft:armor_stand" then return end logger.warn( "[ArmorStandTest] onAttackEntity triggered; returning false" ) return false end) mc.listen("onMobHurt", function(mob, source, damage, cause) if mob == nil or mob.type ~= "minecraft:armor_stand" then return end local sourceType = "nil" if source ~= nil then sourceType = tostring(source.type) end logger.warn( "[ArmorStandTest] onMobHurt triggered" .. "; source=" .. sourceType .. "; damage=" .. tostring(damage) .. "; cause=" .. tostring(cause) .. "; returning false" ) return false end) ``` 1. 加载上述 Lua 测试脚本。 2. 放置一个盔甲架。 3. 使用剑攻击盔甲架,控制台能输出内容 4. 使用长矛攻击盔甲架,控制台无法输出内容 ### Expected behavior 玩家使用长矛攻击盔甲架时,应通过适用的可取消事件通知脚本;脚本返回 `false` 后,盔甲架不应被该次攻击破坏 ### Screenshots <img width="709" height="60" alt="Image" src="https://github.com/user-attachments/assets/dbd18977-4ede-4998-ae04-fc65308b7891" />只有剑可以输出,长矛武器无法输出 ### Platform windows10 ### Version 0.22.2 ### Additional context 有趣的是,长矛攻击其他实体可以被拦截,偏偏拦截不了盔甲架
Activity
yangyangzhong82 commentedon Oct 17, 2026
发错了 去lse那里反馈
[-][Bug] [LegacyScriptEngine] 长矛破坏盔甲架未进入 onAttackEntity / onMobHurt 监听[/-][+][Bug] 长矛破坏盔甲架未进入 onAttackEntity / onMobHurt 监听[/+]