Class AbstractNodeCostSearch
java.lang.Object
com.zenith.feature.pathfinder.calc.AbstractNodeCostSearch
- Direct Known Subclasses:
AStarPathFinder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PathNode[]protected booleanprotected static final double[]This is really complicated and hard to explain.protected final Goalprotected static final doubleIf a path goes less than 5 blocks and doesn't make it to its goal, it's not worth considering.protected static final doublethere are floating point errors caused by random combinations of traverse and diagonal over a flat area that means that sometimes there's a cost improvement of like 10 ^ -16 it's not worth the time to update the costs, decrease-key the heap, potentially repropagate, etcprotected PathNodeprotected final BlockPosprotected PathNodeprotected final intprotected final intprotected final int -
Method Summary
Modifier and TypeMethodDescriptionbestSoFar(int numNodes) bestSoFar(int numNodes, double minDist) calculate(long primaryTimeout, long failureTimeout) calculate0(long primaryTimeout, long failureTimeout) voidcancel()protected doubleDetermines the distance squared from the specified node to the start node.final GoalgetGoal()protected PathNodegetNodeAtPosition(int x, int y, int z, long hashCode) Attempts to search the block position hashCode long toPathNodemap for the node mapped to the specified pos.getStart()final booleanprotected intmapSize()
-
Field Details
-
realStart
-
startX
protected final int startX -
startY
protected final int startY -
startZ
protected final int startZ -
goal
-
startNode
-
mostRecentConsidered
-
bestSoFar
-
cancelRequested
protected boolean cancelRequested -
COEFFICIENTS
protected static final double[] COEFFICIENTSThis is really complicated and hard to explain. I wrote a comment in the old version of MineBot but it was so long it was easier as a Google Doc (because I could insert charts).- See Also:
-
MIN_DIST_PATH
protected static final double MIN_DIST_PATHIf a path goes less than 5 blocks and doesn't make it to its goal, it's not worth considering.- See Also:
-
MIN_IMPROVEMENT
protected static final double MIN_IMPROVEMENTthere are floating point errors caused by random combinations of traverse and diagonal over a flat area that means that sometimes there's a cost improvement of like 10 ^ -16 it's not worth the time to update the costs, decrease-key the heap, potentially repropagate, etcwho cares about a hundredth of a tick? that's half a millisecond for crying out loud!
- See Also:
-
-
Method Details
-
cancel
public void cancel() -
calculate
-
calculate0
-
getDistFromStartSq
Determines the distance squared from the specified node to the start node. Intended for use in distance comparison, rather than anything that considers the real distance value, hence the "sq".- Parameters:
n- A node- Returns:
- The distance, squared
-
getNodeAtPosition
Attempts to search the block position hashCode long toPathNodemap for the node mapped to the specified pos. If no node is found, a new node is created.- Parameters:
x- The x position of the nodey- The y position of the nodez- The z position of the nodehashCode- The hash code of the node, provided byBlockPos.longHash(int, int, int)- Returns:
- The associated node
- See Also:
-
pathToMostRecentNodeConsidered
-
bestPathSoFar
-
bestSoFar
-
bestSoFar
-
isFinished
public final boolean isFinished() -
getGoal
-
getStart
-
mapSize
protected int mapSize()
-