navigation_table
A navigation table. Reports the resolved target's bearing, distance, closure rate, vertical offset, and the host sub-level's orientation/heading.
| hasTarget() | Check whether the nav table has resolved a live target. |
|---|---|
| getTargetType() | Get the registry id of the held nav-table item type. |
| getTargetMetadata() | Get item-specific metadata for the held nav-table item. |
| getRelativeAngle() | Get the raw relative angle to the target, in degrees. |
| getRelativeAngleRad() | Get the raw relative angle to the target, in radians. |
| getBearing() | Get the forward-error bearing to the target. |
| getBearingRad() | Get the forward-error bearing to the target, in radians. |
| getDistanceToTarget() | Get the distance to the resolved target. |
| getClosureRate() | Get the rate at which the table is closing on the target. |
| getVerticalOffsetToTarget() | Get the vertical offset between target and the table's projected position. |
| getOrientation() | Get the host sub-level's orientation as a quaternion. |
| getHeading() | Get the host sub-level's heading in degrees. |
| getHeadingRad() | Get the host sub-level's heading in radians. |
- hasTarget()Source
Check whether the nav table has resolved a live target. hasTarget reports whether the nav table has resolved a live target (currentTarget). getTargetType / getTargetMetadata describe the held nav-table item itself — these can be populated even when no target is locked yet, so hasTarget() == false does not imply getTargetType() == nil.
Returns
booleanTrue if a live target is resolved.
- getTargetType()Source
Get the registry id of the held nav-table item type.
Returns
stringThe target type id, or nil if no item is held.
- getTargetMetadata()Source
Get item-specific metadata for the held nav-table item.
Each nav-target type decides its own keys and value types — there is no fixed schema, and what's in the map depends entirely on which item is held. Use
getTargetTypeto branch before reading keys. Returns{}(empty map, not nil) when no item is held or the held item's type exposes no metadata.Built-in target types and the keys they expose:
Per-target metadata schema `getTargetType()` Keys Notes `simulated:compass` `kind` ("lodestone" | "spawn"), `sublevel_id` (string, lodestone only) "spawn" is the fallback used when the compass isn't bound to a tracked sub-level; `sublevel_id` is the tracker UUID. `simulated:recovery_compass` `placer_uuid` (string, optional) UUID of the player whose death location the compass tracks. Absent until a player has placed the compass into the table. `simulated:map` `map_id` (number, optional) Numeric id of the underlying map item. Absent if the held stack carries no MAP_ID data component (e.g. a blank map). `simulated:magnet` — Static target (10 blocks north of the table); no useful metadata, returns `{}`. Compat target types from upstream Simulated (e.g.
simulated:explorers_compass,simulated:natures_compass) register only when their host mod is present and currently expose no metadata. Third-partyNavigationTargetimplementations can publish their own keys by implementingNavigationTargetExt#getPeripheralMetadatavia mixin.Returns
- { [
string] =any} A map of target-type-specific metadata, or an empty map.
- { [
- getRelativeAngle()Source
Get the raw relative angle to the target, in degrees.
Returns
numberThe relative angle in degrees.
- getRelativeAngleRad()Source
Get the raw relative angle to the target, in radians.
Returns
numberThe relative angle in radians.
- getBearing()Source
Get the forward-error bearing to the target. Forward-error bearing: 0 = target straight ahead of the block's arrow, +90 = target to the right, -90 = to the left, ±180 = behind. The block's arrow points along local +Z, which the raw relativeAngle (atan2(z, x)) encodes as 90°; this method subtracts that offset and wraps to ±180.
Returns
numberThe bearing in degrees, in [-180, 180].
- getBearingRad()Source
Get the forward-error bearing to the target, in radians.
Returns
numberThe bearing in radians.
- getDistanceToTarget()Source
Get the distance to the resolved target. Computed in world frame between the table's projected world position and the target's world position.
Returns
numberThe distance in blocks (= meters in Minecraft units).
- getClosureRate()Source
Get the rate at which the table is closing on the target. Nav table samples distance every 11 ticks (0.55s); closure rate reflects that cadence — short-window jitter is dominated by the sampling granularity.
Returns
numberThe closure rate in blocks/sec (positive = approaching).
- getVerticalOffsetToTarget()Source
Get the vertical offset between target and the table's projected position. Both positions are in world frame (after projecting the table out of any sub-level), so this gives the signed altitude difference regardless of contraption orientation.
Returns
numberThe signed vertical offsettarget.y - self.yin blocks.
- getOrientation()Source
Get the host sub-level's orientation as a quaternion. Quaternion components in {x, y, z, w} order, matching JOML's constructor and the convention used by CC quaternion libraries (e.g. TechTastic/Advanced-Math).
Returns
- {
number... } A four-element list {x, y, z, w}.
- {
- getHeading()Source
Get the host sub-level's heading in degrees. Heading: ship's +Z axis rotated into world frame, yaw measured as atan2(x, z). 0° = facing world +Z (Minecraft south), matches player-yaw convention.
Returns
numberThe heading in degrees.
- getHeadingRad()Source
Get the host sub-level's heading in radians.
Returns
numberThe heading in radians.