feat(ai): add core A* pathfinding algorithms #1422
Open
+3,108
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Implements the foundational A* pathfinding system for entity navigation, addressing the "Navigation / Pathfinding (A* implementation)" item in #1406.
This PR provides the core pathfinding algorithms without navigation controllers or movement controls (which will be added in follow-up PRs as they require entity structure changes).
Core A* Algorithm
Node Evaluators (Movement Types)
Different evaluators handle different entity movement capabilities:
WalkNodeEvaluator (521 lines) - Ground-based walking
SwimNodeEvaluator (321 lines) - Water-based movement
FlyNodeEvaluator (352 lines) - Aerial movement
AmphibiousNodeEvaluator (242 lines) - Hybrid movement
Path Type Awareness
The pathfinding system considers 25 terrain types including:
Algorithm Details
Testing
The pathfinding algorithms are based on vanilla Minecraft 1.21.11 implementation:
PathFinder.javaNotes
This PR lays the foundation for mob AI movement. The navigation controllers (
GroundPathNavigation,FlyingPathNavigation, etc.) and movement controls (MoveControl,JumpControl) will be added in subsequent PRs as they require entity structure modifications.The existing simple
Navigatorinmod.rsremains unchanged as a placeholder for backwards compatibility.Partially addresses #1406: