Class AStarBase
java.lang.Object
com.hypixel.hytale.server.npc.navigation.AStarBase
- Direct Known Subclasses:
AStarWithTarget
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected AStarEvaluatorstatic final doublestatic final doubleprotected static final intprotected longprotected longprotected longprotected int[]protected booleanprotected booleanprotected booleanprotected intprotected intprotected AStarNodePoolprotected int[]protected intstatic final doubleprotected intprotected booleanprotected AStarNodeprotected final Vector3dprotected static final intprotected static final intprotected static final intprotected doubleprotected doubleprotected doubleprotected AStarBase.Progressprotected booleanprotected booleanprotected booleanstatic final doubleprotected double[]protected booleanprotected booleanprotected Vector3d[]protected final Vector3dprotected final Vector3dprotected longprotected final Vector3dprotected final Vector3dprotected intprotected final it.unimi.dsi.fastutil.longs.Long2ObjectMap<AStarNode> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longaddOffsetToIndex(long index, long xSteps, long ySteps, long zSteps) protected voidaddOpenNode(AStarNode parentNode, int directionIndex, Vector3d position, long positionIndex, float cost, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController) protected voidaddOpenNode(AStarNode node, long index) protected voidaddOrUpdateNode(AStarNode node, int directionIndex, Vector3d position, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, ComponentAccessor<EntityStore> componentAccessor) protected voidaddStartNode(Vector3d startPosition, Vector3d position, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController) <T> AStarNodebuildBestPath(BiToFloatFunction<AStarNode, T> weight, BiFloatPredicate predicate, float initialValue, T obj) buildBestPath(ToFloatFunction<AStarNode> weight, BiFloatPredicate predicate, float initialValue) floatfloatprotected voidprotected Vector3dcanAdvance(Ref<EntityStore> ref, Vector3d startPosition, Vector3d destination, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, ProbeMoveData probeMoveData, ComponentAccessor<EntityStore> componentAccessor) voidcomputePath(Ref<EntityStore> ref, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, ProbeMoveData probeMoveData, int nodesToProcess, ComponentAccessor<EntityStore> componentAccessor) createDebugHelper(com.hypixel.hytale.logger.HytaleLogger logger) <T> AStarNodefindBestVisitedNode(BiToFloatFunction<AStarNode, T> weight, BiFloatPredicate predicate, float initialValue, T obj) findBestVisitedNode(ToFloatFunction<AStarNode> weight, BiFloatPredicate predicate, float initialValue) intintintgetPath()longit.unimi.dsi.fastutil.longs.Long2ObjectMap<AStarNode> static longindexFromXYZ(long dx, long dy, long dz) initComputePath(Ref<EntityStore> ref, Vector3d start, AStarEvaluator evaluator, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, ProbeMoveData probeMoveData, AStarNodePoolProvider nodePoolProvider, ComponentAccessor<EntityStore> componentAccessor) booleanprotected floatmeasureWalkCost(Vector3d fromPosition, Vector3d toPosition, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController) static StringpositionIndexToString(long index) protected longpositionToIndex(Vector3d position) voidsetCanMoveDiagonal(boolean canMoveDiagonal) voidsetMaxPathLength(int maxPathLength) voidsetOpenNodesLimit(int openNodesLimit) voidsetOptimizedBuildPath(boolean optimizedBuildPath) protected AStarBase.ProgresssetProgress(AStarBase.Progress progress) voidsetStartPosition(Vector3d position) voidsetTotalNodesLimit(int totalNodesLimit) protected voidupdateNode(AStarNode node, int directionIndex, AStarNode targetNode, com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController) protected voidupdateNodeCost(AStarNode node, int directionIndex, AStarNode targetNode, float stepCost) static intxFromIndex(long index) static intyFromIndex(long index) static intzFromIndex(long index)
-
Field Details
-
FULL_STEP_THRESHOLD
public static final double FULL_STEP_THRESHOLD- See Also:
-
REQUIRED_TARGET_DISTANCE
public static final double REQUIRED_TARGET_DISTANCE- See Also:
-
HALF_STEP_THRESHOLD
public static final double HALF_STEP_THRESHOLD- See Also:
-
ON_GRID_THRESHOLD
public static final double ON_GRID_THRESHOLD- See Also:
-
INDEX_FRACTIONAL_BITS
protected static final int INDEX_FRACTIONAL_BITS- See Also:
-
POSITION_BITS
protected static final int POSITION_BITS- See Also:
-
POSITION_OFFSET
protected static final int POSITION_OFFSET- See Also:
-
POSITION_MASK
protected static final int POSITION_MASK- See Also:
-
maxPathLength
protected int maxPathLength -
openNodesLimit
protected int openNodesLimit -
totalNodesLimit
protected int totalNodesLimit -
canMoveDiagonal
protected boolean canMoveDiagonal -
optimizedBuildPath
protected boolean optimizedBuildPath -
isAvoidingBlockDamage
protected boolean isAvoidingBlockDamage -
isRelaxedMoveConstraints
protected boolean isRelaxedMoveConstraints -
startPosition
-
evaluator
-
positionToIndexOffsetX
protected double positionToIndexOffsetX -
positionToIndexOffsetY
protected double positionToIndexOffsetY -
positionToIndexOffsetZ
protected double positionToIndexOffsetZ -
indexToPositionOffsetX
protected long indexToPositionOffsetX -
indexToPositionOffsetY
protected long indexToPositionOffsetY -
indexToPositionOffsetZ
protected long indexToPositionOffsetZ -
startPositionIndex
protected long startPositionIndex -
is2D
protected boolean is2D -
projectedX
protected boolean projectedX -
projectedY
protected boolean projectedY -
projectedZ
protected boolean projectedZ -
searchDirectionsWorldNormal
-
searchDirectionIsDiagonalMoves
protected boolean searchDirectionIsDiagonalMoves -
searchDirectionIs2D
protected boolean searchDirectionIs2D -
searchDirections
-
searchDirectionDistances
protected double[] searchDirectionDistances -
inverseSearchDirections
protected int[] inverseSearchDirections -
normalsPerDirection
protected int normalsPerDirection -
normalDirections
protected int[] normalDirections -
nodePool
-
openNodes
-
visitedBlocks
-
iterations
protected int iterations -
path
-
progress
-
pathEnd
-
tempPositionVector
-
tempDirectionVector
-
-
Constructor Details
-
AStarBase
public AStarBase()
-
-
Method Details
-
setCanMoveDiagonal
public void setCanMoveDiagonal(boolean canMoveDiagonal) -
setMaxPathLength
public void setMaxPathLength(int maxPathLength) -
setOpenNodesLimit
public void setOpenNodesLimit(int openNodesLimit) -
setTotalNodesLimit
public void setTotalNodesLimit(int totalNodesLimit) -
setStartPosition
-
getStartPosition
-
setOptimizedBuildPath
public void setOptimizedBuildPath(boolean optimizedBuildPath) -
getEvaluator
-
getOpenNodes
-
getOpenCount
public int getOpenCount() -
getVisitedBlocks
-
getStartPositionIndex
public long getStartPositionIndex() -
getPath
-
getPosition
-
getLength
public int getLength() -
getIterations
public int getIterations() -
getEndPosition
-
clearPath
public void clearPath() -
computePath
public AStarBase.Progress computePath(@Nonnull Ref<EntityStore> ref, @Nonnull com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, @Nonnull ProbeMoveData probeMoveData, int nodesToProcess, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
getProgress
-
isComputing
public boolean isComputing() -
buildLongestPath
public float buildLongestPath() -
buildFurthestPath
public float buildFurthestPath() -
buildBestPath
@Nullable public AStarNode buildBestPath(@Nonnull ToFloatFunction<AStarNode> weight, @Nonnull BiFloatPredicate predicate, float initialValue) -
findBestVisitedNode
@Nullable public AStarNode findBestVisitedNode(@Nonnull ToFloatFunction<AStarNode> weight, @Nonnull BiFloatPredicate predicate, float initialValue) -
buildBestPath
@Nullable public <T> AStarNode buildBestPath(@Nonnull BiToFloatFunction<AStarNode, T> weight, @Nonnull BiFloatPredicate predicate, float initialValue, T obj) -
findBestVisitedNode
@Nullable public <T> AStarNode findBestVisitedNode(@Nonnull BiToFloatFunction<AStarNode, T> weight, @Nonnull BiFloatPredicate predicate, float initialValue, T obj) -
createDebugHelper
@Nonnull public AStarDebugBase createDebugHelper(@Nonnull com.hypixel.hytale.logger.HytaleLogger logger) -
indexFromXYZ
public static long indexFromXYZ(long dx, long dy, long dz) -
zFromIndex
public static int zFromIndex(long index) -
yFromIndex
public static int yFromIndex(long index) -
xFromIndex
public static int xFromIndex(long index) -
positionIndexToString
-
canAdvance
@Nullable protected Vector3d canAdvance(@Nonnull Ref<EntityStore> ref, @Nonnull Vector3d startPosition, @Nonnull Vector3d destination, @Nonnull com.hypixel.hytale.server.npc.movement.controllers.MotionController motionController, @Nonnull ProbeMoveData probeMoveData, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
addStartNode
-
positionToIndex
-
measureWalkCost
-
addOffsetToIndex
protected long addOffsetToIndex(long index, long xSteps, long ySteps, long zSteps)
-