Create: Sentry Mechanical Arm_非官方移植

Enable the creation of a robotic arm to use TaCZ firearms, and it is compatible with aeronautics

File Details

sentrymechanicalarm-neoforge-1.21.1-1.3.1.jar

  • R
  • Jun 2, 2026
  • 438.35 KB
  • 8
  • 1.21.1
  • NeoForge

File Name

sentrymechanicalarm-neoforge-1.21.1-1.3.1.jar

Supported Versions

  • 1.21.1

Curse Maven Snippet

NeoForge

implementation "curse.maven:create-sentry-mechanical-arm-1-1551674:8185366"
Curse Maven does not yet support mods that have disabled 3rd party sharing

Learn more about Curse Maven

功能性解释 / Functional Explanation
1. Binding Visualization Protection / 绑定粒子线保护
CN: SentryLinkHandler.renderParticleLine 添加 dist > 100 提前返回。当玩家在普通世界持有扳手,准心指向 Sable 子世界方块时,firstSelectedPos 可能是子世界坐标(如 20481031),而 lookPos 是普通世界坐标(如 16)。两者距离约 2896 万格,原代码会尝试计算 1.4 亿个粒子点,导致游戏冻结。现直接跳过超距渲染,不影响绑定逻辑本身。
EN: Added early-return guard (dist > 100) in renderParticleLine. When the player holding a wrench in the main world looks at a Sable sub-world block, firstSelectedPos may be a sub-world coordinate (e.g., 20481031) while lookPos is a world coordinate (e.g., 16). This creates a ~28M block distance that would cause the game to freeze trying to compute ~144M particle positions. Now skips rendering for impossible distances; binding logic is unaffected.
2. Fire Control Count Update on Bind / 绑定后火控台即时更新计数
CN: 绑定包在服务端调用 SentryArmBlockEntity.setConnectedFireControl() 后,原代码不会通知火控台更新哨戒臂列表。扳眼镜查看火控台始终显示 0。现追加 fc.notifyConnectedSentries(false),使火控台立即扫描 ±6 格内的已绑定哨戒臂,更新 sentryPositionData 并通过 sendData() 同步到客户端。
EN: After the binding packet calls setConnectedFireControl() server-side, the fire control was never notified to refresh its sentry list. The goggle tooltip always showed 0. Now appends fc.notifyConnectedSentries(false), which immediately scans ±6 blocks for bound sentries, updates sentryPositionData, and syncs to client via sendData().
3. Render-Thread Safe Projected Coordinates / 渲染线程安全的投影坐标
CN: 原代码在渲染线程调用 AeronauticsHelper.sableSubLevelToWorld()(Sable API),可能导致渲染线程死锁。现改为在服务端/主线程(notifyConnectedSentries 和 setConnectedFireControl 中)提前计算世界投影坐标,存入 projectedSentryPositions / projectedFireControlPos,通过 NBT 同步到客户端。渲染线程只读这些缓存,零 Sable API 调用。
EN: The original code called AeronauticsHelper.sableSubLevelToWorld() (Sable API) on the render thread, risking deadlock. Now world-projected coordinates are pre-computed server-side/main-thread in notifyConnectedSentries and setConnectedFireControl, stored in projectedSentryPositions / projectedFireControlPos, and synced to clients via NBT. The render thread only reads these cached values — zero Sable API calls.
4. HUD Frame Cache / HUD 帧缓存
CN: SentryHudHandler.renderOverlay() 每帧在渲染线程执行射线检测(level.clip())、实体碰撞搜索(ProjectileUtil.getEntityHitResult())和动块枚举(getEntitiesOfClass(AbstractContraptionEntity) + contraption.getActors())。当物理结构在场时,每帧枚举全部动块和所有 actor 导致渲染阻塞。现添加帧计数器:射线检测和BE查询每 5 帧刷新一次,动块枚举每 10 帧刷新一次,中间帧使用缓存数据。
EN: SentryHudHandler.renderOverlay() performed raycasting (level.clip()), entity collision search (ProjectileUtil.getEntityHitResult()), and contraption enumeration (getEntitiesOfClass(AbstractContraptionEntity) + contraption.getActors()) every frame on the render thread. With physics structures present, full contraption + actor iteration each frame caused render blocking. Now adds frame counters: raycasts and BE lookups refresh every 5 frames, contraption scans every 10 frames, using cached data between refreshes.
5. Scan Frequency Optimization / 扫描频率优化
CN: 哨戒臂的 scanCooldown 从 20 tick(每秒 1 次)改为 4 tick(每秒 5 次),提高索敌响应速度。
EN: Changed scanCooldown from 20 ticks (1/sec) to 4 ticks (5/sec) for faster target acquisition response.