Upload files to "/"

This commit is contained in:
2026-06-01 09:00:25 +00:00
parent 30b3ef72a4
commit 176395b9cd
5 changed files with 476 additions and 12 deletions

35
PathNode.java Normal file
View File

@@ -0,0 +1,35 @@
package xyz.nodrop.farmingtools.client.pathfinding;
import net.minecraft.util.math.BlockPos;
/**
* Single node in the A* search graph.
* Comparable by f = g + h so it can be used directly in a PriorityQueue.
*/
public class PathNode implements Comparable<PathNode> {
public final BlockPos pos;
public final PathNode parent;
/** Cost from start to this node. */
public final double g;
/** Heuristic cost estimate from this node to goal. */
public final double h;
public PathNode(BlockPos pos, PathNode parent, double g, double h) {
this.pos = pos;
this.parent = parent;
this.g = g;
this.h = h;
}
public double f() {
return g + h;
}
@Override
public int compareTo(PathNode other) {
return Double.compare(this.f(), other.f());
}
}