Skip to main content

Navigation API

Namespace: hexis.navigate

Not sure which function to use?

See Choosing the Right Function for a decision tree and side-by-side comparison of all navigation and mining functions.

Target Coordinates

Navigation targets must be air blocks where the player can stand, not solid blocks. The Y coordinate should be the position of the player's feet (the air block above the ground).

When using the distance parameter (for approaching solid blocks like trees), the system automatically adds +1 to the Y coordinate, assuming you provided the solid block position.


Basic Navigation

hexis.navigate.to(target)

Navigates to a location using A* pathfinding.

Blocking: Yes (waits until arrival or failure)

Returns: true if navigation started successfully, false if path is impossible

-- Navigate by coordinates (player standing position)
hexis.navigate.to({x = 100, y = 65, z = 200})

-- Navigate by location name (from routes/markers)
hexis.navigate.to("pillar_1")

-- Navigate near a solid block (like a tree trunk)
-- Y+1 is automatically added when distance > 0
hexis.navigate.to({
x = block.x,
y = block.y, -- Solid block Y, system adds +1 automatically
z = block.z,
distance = 3 -- Stop 3 blocks away from target
})

-- With all options
hexis.navigate.to({
x = 100, y = 64, z = 200,
distance = 3, -- Stop this many blocks from target (default: 0.5)
timeout = 30000, -- Max 30 seconds
exact = true, -- Stop exactly at target (overrides distance)
allow_drops = true -- Allow dropping down ledges (default: true)
})

Parameters:

ParameterTypeDefaultDescription
x, y, znumberRequiredTarget coordinates
distancenumber0.5How close to get (for approaching solid blocks, use 2-4)
timeoutnumber60000Maximum navigation time (ms)
exactbooleanfalseStop exactly at target block center
allow_dropsbooleantrueAllow pathfinding through drops/ledges

Approach Navigation

hexis.navigate.near(options)

Navigates to a valid standing position near a solid block. Uses GoalApproach which finds positions with line-of-sight and exposed faces. Ideal for approaching TNT blocks, chests, or other interactable solid blocks where you need to stand nearby rather than on top.

Blocking: No (use is_navigating() to poll)

Returns: true if navigation started, false if target has no exposed faces or path failed

-- Approach a TNT block
local started = hexis.navigate.near({
x = -464, y = 119, z = -81,
range = 4.0
})

if started then
while hexis.navigate.is_navigating() do
hexis.wait(0.1)
end
hexis.log.info("Arrived near block!")
end

-- With custom min range (stay between 2 and 5 blocks away)
hexis.navigate.near({
x = chest.x, y = chest.y, z = chest.z,
range = 5.0,
min_range = 2.0
})

Parameters:

ParameterTypeDefaultDescription
x, y, znumberrequiredTarget solid block coordinates
rangenumber4.0Maximum approach distance
min_rangenumber1.0Minimum approach distance
navigate.near() vs navigate.to() with distance

Use navigate.near() for solid blocks (TNT, chests, interactables) — it validates exposed faces and line-of-sight. Use navigate.to() with distance for navigating near air positions where the player could stand.


Etherwarp

hexis.navigate.etherwarp(target)

Teleports using etherwarp ability (requires Aspect of the End).

hexis.navigate.etherwarp({x = 100, y = 64, z = 200})
hexis.navigate.etherwarp("saved_location")

hexis.navigate.smart_etherwarp(options)

Smart etherwarp with line-of-sight detection.

hexis.navigate.smart_etherwarp({
target = "pillar_1",
distance = 48, -- Max etherwarp distance
timeout = 5000 -- Max wait for LOS
})

Async Navigation

hexis.navigate.start_async(options)

Starts A* pathfinding and returns immediately. The script controls the wait loop, which allows for interrupts (competition events, danger detection, etc.).

Blocking: No (returns after path computation)

Returns: true if pathfinding started, false if no path found

-- Basic async navigation
local started = hexis.navigate.start_async({
x = 100.5, y = 65, z = 200.5,
distance = 2.0
})

if started then
while hexis.navigate.is_navigating() do
if not hexis.script.is_running() then break end
-- Can do other things here (check events, update HUD, etc.)
hexis.wait(0.05)
end
end

Parameters:

ParameterTypeDefaultDescription
x, y, znumberrequiredTarget coordinates
distancenumber2.0Goal tolerance radius
max_nodesint-1Max A* nodes (-1 = use config default)
max_timenumber-1Max compute time in seconds
reach_targettablenil{x, y, z} block for mining-aware navigation (enables LOS-based early arrival)

With reach_target (mining-aware navigation):

When reach_target is set, the pathfinder uses GoalApproach.forBlockMining and enables early arrival when the player has line-of-sight to the target block. This is what mine_nearest() uses internally.

hexis.navigate.start_async({
x = vantage.x, y = vantage.y, z = vantage.z,
distance = 1.5,
reach_target = {x = ore.x, y = ore.y, z = ore.z}
})
When to use start_async vs to vs near
  • start_async() — When you need to do things during navigation (check events, update HUD, handle interrupts). Most production scripts use this.
  • to() — Simple blocking navigation where you just want to wait until arrival.
  • near() — Approaching solid blocks that need line-of-sight validation (chests, TNT, NPC areas).

See Choosing the Right Function for a detailed comparison.


Water Navigation

hexis.navigate.swim_to(options)

Underwater A* pathfinding using native Rust swim pathfinder.

Blocking: No (starts swim following, returns immediately)

Returns: true if path found and swim following started

local ok = hexis.navigate.swim_to({
x = 100, y = 30, z = 200,
max_nodes = 35000,
heuristic_weight = 1.2
})

if ok then
while hexis.navigate.is_swim_navigating() do
hexis.wait(0.05)
end
end

Parameters:

ParameterTypeDefaultDescription
x, y, znumberrequiredTarget coordinates
max_nodesint35000Max A* nodes
heuristic_weightfloat1.2A* heuristic weight

hexis.navigate.is_swim_navigating()

Returns true if currently swim-navigating.

hexis.navigate.is_in_water()

Returns true if player is in water.

hexis.navigate.is_swimming()

Returns true if player is in swim mode.

hexis.navigate.is_underwater(pos)

Returns true if position (or player, if no args) is underwater.

hexis.navigate.get_water_surface_y(x, z)

Returns the Y level of the water surface at the given coordinates, or -1 if no water.


Blacklist Management

hexis.navigate.blacklist(pos)

Mark a position as unreachable. The pathfinder will avoid it.

hexis.navigate.blacklist({x = 100, y = 65, z = 200})

hexis.navigate.is_blacklisted(pos)

Returns true if the position is blacklisted.

hexis.navigate.clear_blacklist(pos)

Clear a specific position from the blacklist, or clear the entire blacklist if no args.

hexis.navigate.clear_blacklist({x = 100, y = 65, z = 200})  -- Clear one
hexis.navigate.clear_blacklist() -- Clear all

hexis.navigate.get_blacklist_count()

Returns the number of blacklisted positions.


Camera Lock

Lock the camera on a target while the pathfinder uses WASD-only movement. Useful for mining while walking.

hexis.navigate.set_camera_lock(target, hard_lock)

-- Soft lock (blends with path direction)
hexis.navigate.set_camera_lock({x = 100, y = 70, z = 200})

-- Hard lock (strict aim at target)
hexis.navigate.set_camera_lock({x = 100, y = 70, z = 200}, true)

hexis.navigate.clear_camera_lock()

Release camera lock and return to normal navigation.

hexis.navigate.has_camera_lock()

Returns true if camera lock is active.

hexis.navigate.find_ground_position(options)

Find a valid standing position near a target. Returns the position closest to the target (not the player).

local pos = hexis.navigate.find_ground_position({
x = tree.x, y = tree.y, z = tree.z,
search_radius = 5
})

if pos then
hexis.navigate.start_async({x = pos.x, y = pos.y, z = pos.z})
end

hexis.navigate.drop()

Drops down from current position (disable flight, freefall).

hexis.navigate.drop()

hexis.navigate.arrived()

Returns true if navigation is complete.

hexis.navigate.to({x = 100, y = 64, z = 200})
while not hexis.navigate.arrived() do
hexis.wait(0.1)
end
hexis.log.info("Arrived!")

hexis.navigate.is_navigating()

Returns true if currently navigating.

if hexis.navigate.is_navigating() then
hexis.log.info("Still moving...")
end

hexis.navigate.stop()

Stops current navigation.

hexis.navigate.stop()

Location Checks

hexis.navigate.check_location(target)

Checks if the player is at a location.

if hexis.navigate.check_location("pillar_1") then
hexis.log.info("At pillar_1")
end

if hexis.navigate.check_location({x = 100, y = 65, z = 200}) then
hexis.log.info("At coords")
end

hexis.navigate.look_at(target)

Looks at a target position or named location.

hexis.navigate.look_at({x = 100, y = 65, z = 200})
hexis.navigate.look_at("pillar_1")

Debug Tools

hexis.navigate.debug_heatmap(opts)

Renders a pathfinding heatmap for debugging navigation issues.

hexis.navigate.debug_heatmap({
radius = 20,
height = 5
})

hexis.navigate.debug_heatmap_analysis(opts)

Performs analysis on the pathfinding heatmap data.

hexis.navigate.debug_heatmap_analysis({
radius = 20,
height = 5
})

Multi-Target Mining Navigation

When to use Multi-Target A*

Use hexis.mining.mine_nearest() when you have multiple possible targets (e.g., trees, ores, crops) and want the pathfinder to find the closest reachable one by actual path cost — not just Euclidean distance. This is significantly more efficient than sorting targets by distance and trying them one at a time with hexis.navigate.to().

hexis.mining.mine_nearest(options)

Finds the nearest reachable block from a list using Multi-Target A* with a min-distance heuristic, then navigates to a standing position where the player can interact with it.

Default: BLOCKING — waits until navigation completes. Pass async = true to return immediately after starting navigation.

-- Basic blocking usage
local result = hexis.mining.mine_nearest({
targets = trees, -- Array of {x, y, z} positions
distance = 1.0 -- How close to get to standing position
})

if result.success then
hexis.log.info("Ready to mine at " .. result.target.x)

if result.jump_mine then
hexis.player.jump()
hexis.wait(0.3)
end

hexis.mining.start_mining_async({
x = result.aim_point.x,
y = result.aim_point.y,
z = result.aim_point.z
})
end

-- Async mode — starts nav, returns immediately for scripts that need
-- to do work during navigation (e.g., opportunistic mining)
local result = hexis.mining.mine_nearest({
targets = block_list,
distance = 1.5,
max_nodes = 200000,
max_time_ms = 2000,
allow_jump_mine = true,
async = true
})

if result.success then
-- Navigation already started — manage wait loop yourself
while hexis.navigate.is_navigating() do
-- do opportunistic stuff...
hexis.wait(0.1)
end
end

Parameters:

ParameterTypeDefaultDescription
targetsarrayRequiredArray of {x, y, z} block positions to search
distancenumber1.0How close to navigate to the standing position
max_nodesnumber50000Maximum A* nodes to expand
max_time_msnumber2000Maximum search time in milliseconds
goal_tolerancenumber2.5Distance tolerance for reaching goal
allow_jump_minebooleanfalseIf true AND player has Jump Boost, sets jump_mine = true for overhead blocks
asyncbooleanfalseIf true, starts navigation and returns immediately instead of blocking

Returns: table with:

FieldTypeDescription
successbooleanWhether a target was found and navigation completed (or started, if async)
targettable{x, y, z} of the block found
standing_postable{x, y, z} where the player navigated to (or is navigating to)
needs_jumpbooleanWhether the block is overhead (requires jumping to reach)
jump_minebooleantrue only if needs_jump AND allow_jump_mine AND player has Jump Boost
has_jump_boostbooleanWhether player currently has Jump Boost effect
aim_pointtable{x, y, z} optimal point to aim at for mining
path_costnumberA* path cost to the target
nodes_examinednumberNumber of A* nodes examined
compute_time_msnumberSearch computation time
failure_reasonstringReason for failure (only if success is false)
Deprecated aliases

hexis.navigate.to_nearest_block() and hexis.navigate.find_nearest_target() have been removed. Use hexis.mining.mine_nearest() instead. The old hexis.mining.find_nearest_reachable() still works as a backward-compatible alias.