Back to mods
A* Pathfinding project artwork

Modrinth · Minecraft mod

A* Pathfinding

Minecraft Pathfinder for Entities

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which A* Pathfinding release matches 26.3-snapshot-2?

Updated 3 months ago
beta file 0.7.1+mod
Game version 1.21-pre1, 1.21-pre2, 1.21-pre3
Loader Fabric, Forge, NeoForge

A* Pathfinding 0.7.1+mod targets 1.21-pre1, 1.21-pre2, 1.21-pre3 with Fabric, Forge, NeoForge. Installation on the client is optional. Installation on the dedicated server is optional. No extra mods listed for this file.

Where it goes

Is A* Pathfinding required on the client, server, or both?

Installation on the client is optional. Installation on the dedicated server is optional.

Client Optional
Dedicated server Optional
Loader for this release Fabric, Forge, NeoForge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source marks this as usable on both the client and server.

What else does A* Pathfinding 0.7.1+mod need?

0.7.1+mod on 26.3-snapshot-2. Every mod below is checked against that same setup.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add A* Pathfinding without breaking your instance.

Built for A* Pathfinding 0.7.1+mod on 26.3-snapshot-2. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use 0.7.1+mod. It targets 1.21-pre1, 1.21-pre2, 1.21-pre3 with Fabric, Forge, NeoForge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    Installation on the client is optional. Installation on the dedicated server is optional.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside 0.7.1+mod. It opens that exact file at the source.

About this project

What does A* Pathfinding add?

Please also contribute to this project. I don't have infinite time on my hands 🥺

✅ Features

  • Function to find the path to a destination

📖 Usage

Call the astar:_ function and use the remaining markers tagged astar to guide anything
The starting position of the path will be located at the current entity, with the end position being the current position in the context
E.g. execute as @s at @p[distance=1..] run function astar:_
Note that floating destinations & unreached targets will result in failure

I recommend setting the maxCommandChainLength gamerule high enough for your terrain, or restrict the path to a maximum of ~10 blocks — otherwise, temporary markers may stay once the limit is reached

Config

The configuration is stored in the astar.config scoreboard objective.
scoreboard players set maxDistance astar.config <maxDistance>default: 100 (10 blocks) — max distance the pathfinder may travel till finalizing the path.
scoreboard players set maxStepHeight astar.config <maxStepHeight>default: 1 — how many blocks it may walk up at once.
scoreboard players set maxFallDistance astar.config -<maxFallDistance>default: -3negative value, how many blocks it may fall each step.
To avoid conflicts with others' usage, run function astar:default_config or scoreboard players reset * astar.config before your logic

Block Tags

#astar:climbable — climbable
#astar:obstructs_floor — traversable, no descent
#astar:impassable_floor — impassable floor
#astar:impassable_wall — impassable wall

Penalty Block Tags

#astar:penalty/damage 160 — nearby
#astar:penalty/danger 80 — nearby
#astar:penalty/disliked 80

You may add a function to the #astar:eval_node tag to modify costs — return <any> results in only impassable being effective
— impassable via kill @s — add/remove cost via scoreboard players add/remove @s astar.f <amount>

Penalties increase the cost of a path segment, so the algorithm prefers other routes.

Example code

#code:loop.mcfunction:

data modify storage code:pathfinding points append from entity @s Pos
kill @s
execute as @n[type=marker,tag=astar] at @s run function code:loop


#code:main.mcfunction:

execute store success score found my_score at @n[tag=target] if function astar:_ as @n[type=marker,tag=astar,sort=furthest] at @s run function code:loop
execute unless score found my_score matches 1 run function code:set_direct_target # Walk directly towards target if no path is found

Project description from Modrinth.

Pick your setup

A* Pathfinding by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

400 available setups

Showing the newest 12 of 80 game versions. Older files are in the list below.

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

A* Pathfinding versions and loaders

2 of 28 releases match
Clear filters

Looking for an older file? The official Modrinth project page is in Resources.