LocationInteractableStep

坐标交互步骤

基本信息

属性 值
路径 com.gtnewhorizons.navigator.api.model.steps.LocationInteractableStep
行数 38
继承 extends RenderStep
子接口 InteractableStep

三个 default 方法

方法 行 默认行为
onClick(boolean isDoubleClick, int mouseX, int mouseY, int blockX, int blockZ) — 返回 false(未消费)
onKeyPressed(int keyCode) :31-~37 派发 NavigatorApi.ACTION_KEY
(继承)getLocation() — 返回 null

onKeyPressed 的默认派发(:26-27 的 javadoc)

The default implementation dispatches {@link NavigatorApi#ACTION_KEY}

即不覆写时:

  • 若 keyCode == ACTION_KEY(默认 DELETE)→ 调 onActionKeyPressed()
  • 其它按键 → 返回 false

⚠️ 只有 ACTION_KEY 一个键被派发。 要支持更多键必须覆写本方法。

与 InteractableStep 的差异

接口 新增
本接口 坐标 + 点击 + ACTION_KEY
InteractableStep getLocation() / getLocationProvider() 返回 IWaypointAndLocationProvider

⚠️ 本接口的 getLocation() 继承自 RenderStep, 返回 ILocationProvider(没有路点能力)。

推荐的实现路径

README.md 说明 Use UniversalLocationInteractableStep for non-waypoint interaction —— 所以本接口的推荐实现是 UniversalLocationInteractableStep(75 行)。

⚠️ 而 InteractableStep 的 javadoc 明确说本层 remains for source and binary compatibility —— 新代码不应直接实现它。

相关