diff --git a/common/buildcraft/core/robots/AIRobotMoveToBlock.java b/common/buildcraft/core/robots/AIRobotMoveToBlock.java index 6c31e06c..38c658eb 100755 --- a/common/buildcraft/core/robots/AIRobotMoveToBlock.java +++ b/common/buildcraft/core/robots/AIRobotMoveToBlock.java @@ -12,14 +12,15 @@ import java.util.LinkedList; import buildcraft.core.BlockIndex; import buildcraft.core.utils.PathFinding; +import buildcraft.core.utils.PathFindingJob; import buildcraft.robots.EntityRobotBase; public class AIRobotMoveToBlock extends AIRobotMove { private PathFinding pathSearch; + private PathFindingJob pathSearchJob; private LinkedList path; private double prevDistance = Double.MAX_VALUE; - private float finalX, finalY, finalZ; public AIRobotMoveToBlock(EntityRobotBase robot, int x, int y, int z) { @@ -46,6 +47,9 @@ public class AIRobotMoveToBlock extends AIRobotMove { pathSearch = new PathFinding(robot.worldObj, new BlockIndex((int) Math.floor(robot.posX), (int) Math.floor(robot.posY), (int) Math.floor(robot.posZ)), new BlockIndex( (int) Math.floor(finalX), (int) Math.floor(finalY), (int) Math.floor(finalZ))); + + pathSearchJob = new PathFindingJob(pathSearch); + pathSearchJob.start(); } } @@ -64,11 +68,11 @@ public class AIRobotMoveToBlock extends AIRobotMove { prevDistance = robot.getDistance(nextX, nextY, nextZ); } } else { - pathSearch.iterate(PathFinding.PATH_ITERATIONS); - - if (pathSearch.isDone()) { - path = pathSearch.getResult(); - setNextInPath(); + if (!pathSearchJob.isAlive()) { + if (pathSearch.isDone()) { + path = pathSearch.getResult(); + setNextInPath(); + } } } diff --git a/common/buildcraft/core/robots/boards/BoardRobotLumberjack.java b/common/buildcraft/core/robots/boards/BoardRobotLumberjack.java index 941a4fa4..8e8acfd2 100755 --- a/common/buildcraft/core/robots/boards/BoardRobotLumberjack.java +++ b/common/buildcraft/core/robots/boards/BoardRobotLumberjack.java @@ -52,11 +52,7 @@ public class BoardRobotLumberjack extends RedstoneBoardRobot { public static boolean isFreeWoodTarget(BlockIndex index) { synchronized (woodTargets) { - if (!woodTargets.contains(index)) { - return true; - } else { - return false; - } + return !woodTargets.contains(index); } } diff --git a/common/buildcraft/core/utils/PathFinding.java b/common/buildcraft/core/utils/PathFinding.java index ef4925c2..3227dddc 100755 --- a/common/buildcraft/core/utils/PathFinding.java +++ b/common/buildcraft/core/utils/PathFinding.java @@ -39,7 +39,7 @@ public class PathFinding { private LinkedList result; - public boolean endReached = false; + private boolean endReached = false; public PathFinding(World iWorld, BlockIndex iStart, BlockIndex iEnd) { world = iWorld;