Waypoint
路点模型
基本信息
| 属性 | 值 |
|---|---|
| 路径 | com.gtnewhorizons.navigator.api.model.waypoints.Waypoint |
| 行数 | 29 |
| 类型 | class(6 个 public final 字段 + 一个构造器) |
6 个 final 字段(:6-11)
| 字段 | 类型 | 含义 |
|---|---|---|
blockX |
int |
方块 X |
blockY |
int |
方块 Y(含高度) |
blockZ |
int |
方块 Z |
dimensionId |
int |
维度 ID |
label |
String |
显示名 |
color |
int |
颜色(ARGB?见下) |
⚠️ 全部 public final ——
本类是不可变值对象,无 setter,无 equals / hashCode 覆写
(29 行放不下 6 个字段的 getter + 两个覆写 + 构造器 + javadoc,
所以很可能没有 equals / hashCode)。
⚠️ 后果:Waypoint 不能直接做 Map 键 / Set 元素去重 ——
会退化为引用比较。路点去重要靠 WaypointManager 自己实现
(见 WaypointManager)。
⚠️ blockY 在本类里是必需的 ——
而 ILocationProvider 的默认 identity
只有区块 X/Z(没有 Y)。
所以从数据点到路点需要额外提供高度,
由 IWaypointAndLocationProvider 桥接。
构造器(:21-27)
public Waypoint(int blockX, int blockY, int blockZ, int dimensionId, String label, int color)
6 参数全填,无默认 / 无重载。
⚠️ color 是 int 而不是 java.awt.Color ——
1.7.10 客户端代码里 java.awt.Color 可用但不轻量,
且 Minecraft 习惯用 ARGB int。具体打包顺序
(ARGB vs RGB vs 0xRRGGBB)源码无注释,
消费方需按目标地图模组的期望传值。
与地图侧路点的差异
| 实现 | 行 | 特点 |
|---|---|---|
| JMWaypointManager(65 行) | — | JourneyMap 5 |
| XaeroWaypointManager(83 行) | — | Xaero |
| WaypointWithDimension(31 行) | — | Xaero 侧,额外带维度 |
| JourneyMapV6WaypointManager(64 行) | — | JourneyMap 6 |
| VoxelMapWaypointManager(75 行) | — | 无调用点 |
⚠️ WaypointWithDimension 单独存在
说明 Xaero 的路点 API 需要显式带维度,
与本类的 dimensionId 字段形成转换。
相关
- WaypointManager - 管理本对象的抽象类
- IWaypointAndLocationProvider - 从数据点到路点的桥
- XaeroWaypointManager - 地图侧实现之一