From 15fa12fe08515ff1e2b5f45c3abf16445b60d204 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 22 Sep 2018 09:04:10 -0700 Subject: [PATCH] end of an era. stop randomizing movements --- .../baritone/pathing/calc/AStarPathFinder.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 8e5801df..f5c3eacd 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -39,7 +39,6 @@ import net.minecraft.util.math.BlockPos; import java.util.Collection; import java.util.HashSet; import java.util.Optional; -import java.util.Random; /** * The actual A* pathfinding @@ -50,8 +49,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { private final Optional> favoredPositions; - private final Random random = new Random(); - public AStarPathFinder(BlockPos start, Goal goal, Optional> favoredPositions) { super(start, goal); this.favoredPositions = favoredPositions.map(HashSet::new); // <-- okay this is epic @@ -107,8 +104,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { logDebug("Took " + (System.nanoTime() / 1000000L - startTime) + "ms, " + numMovementsConsidered + " movements considered"); return Optional.of(new Path(startNode, currentNode, numNodes, goal)); } - Movement[] possibleMovements = getConnectedPositions(currentNodePos, calcContext);//movement that we could take that start at currentNodePos, in random order - shuffle(possibleMovements); + Movement[] possibleMovements = getConnectedPositions(currentNodePos, calcContext);//movement that we could take that start at currentNodePos for (Movement movementToGetToNeighbor : possibleMovements) { if (movementToGetToNeighbor == null) { continue; @@ -248,14 +244,4 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { MovementParkour.generate(pos, EnumFacing.SOUTH, calcContext), }; } - - private void shuffle(T[] list) { - int len = list.length; - for (int i = 0; i < len; i++) { - int j = random.nextInt(len); - T t = list[j]; - list[j] = list[i]; - list[i] = t; - } - } }