Class NodeManager
java.lang.Object
com.chiefminingdad.autoplayer.node.NodeManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new node to the system in the next available slot.net.minecraft.core.Vec3i[]addSurroundingNodes(Node centre) Gets all surrounding nodes, adds all previously unused locations to the List and HashTablebooleancontainsVector(net.minecraft.core.Vec3i vector) static doublegetDistanceWeight(@NonNull net.minecraft.core.Vec3i CurrentNode, net.minecraft.core.Vec3i FinalNode) A function that will be used for the heuristic required for the A* pathfinding algorithm.getNode(int index) getNode(net.minecraft.core.Vec3i vector) intgetNodeIndex(net.minecraft.core.Vec3i vector) static net.minecraft.core.Vec3i[]getSurrounding(net.minecraft.core.Vec3i centre) voidresetStartNode(Node first) Used when the pathfinding needs to start from a new location as all previous data is useless.voidvoidUsed in case a node is removed from the list and the dictionary needs to be updated.
-
Field Details
-
ReferenceTable
-
NodeList
-
-
Constructor Details
-
NodeManager
-
-
Method Details
-
resetStartNode
Used when the pathfinding needs to start from a new location as all previous data is useless.- Parameters:
first- Which node is going to be the starting node.
-
addNode
Adds a new node to the system in the next available slot.- Parameters:
newNode- The node to be added
-
updateIndexes
public void updateIndexes()Used in case a node is removed from the list and the dictionary needs to be updated. -
getNodeIndex
public int getNodeIndex(net.minecraft.core.Vec3i vector) - Parameters:
vector- The position of the requested Node in the world.- Returns:
- The index of the node with the specified coordinate in the list.
-
getNode
-
getNode
-
setNode
-
containsVector
public boolean containsVector(net.minecraft.core.Vec3i vector) - Parameters:
vector- The vector to check whether is stored.- Returns:
- Whether there is a Vector of the same value stored.
-
getDistanceWeight
public static double getDistanceWeight(@NonNull net.minecraft.core.Vec3i CurrentNode, net.minecraft.core.Vec3i FinalNode) A function that will be used for the heuristic required for the A* pathfinding algorithm.- Returns:
- The distance weight from the given node to the given end node.
-
addSurroundingNodes
Gets all surrounding nodes, adds all previously unused locations to the List and HashTable- Parameters:
centre- The position for all the new vectors to come from.- Returns:
Vec3i[] The array of all locations that had a duplicate already stored.
-
getSurrounding
public static net.minecraft.core.Vec3i[] getSurrounding(net.minecraft.core.Vec3i centre) - Parameters:
centre- The location at which to return the surrounding vectors from.- Returns:
- An array of all the vectors adjacent to the centre.
-