Source:
public BulldozerMovePath findPathToCoords(Entity entity, Set<Coords> destinationCoords, boolean jump) { BulldozerMovePath startPath = new BulldozerMovePath(entity.getGame(), entity); if(jump && (startPath.getCachedEntityState().getJumpMPWithTerrain() > 0) && !entity.isProne() && !entity.isHullDown() && (entity.getGame().getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_TORNADO_F4)) { startPath.addStep(MoveStepType.START_JUMP); } else if (jump) { return null; } else { if(entity.hasETypeFlag(Entity.ETYPE_INFANTRY)) { startPath.addStep(MoveStepType.CLIMB_MODE_OFF); } else { startPath.addStep(MoveStepType.CLIMB_MODE_ON); } } if(entity.isProne() || entity.isHullDown()) { startPath.addStep(MoveStepType.GET_UP); } Coords closest = getClosestCoords(destinationCoords, entity); if (closest == null) { return null; } movePathComparator = new AStarComparator(closest); maximumCost = Integer.MAX_VALUE; TreeSet<BulldozerMovePath> candidates = new TreeSet<>(movePathComparator); candidates.add(startPath); Map<Coords, BulldozerMovePath> shortestPathsToCoords = new HashMap<>(); shortestPathsToCoords.put(startPath.getFinalCoords(), startPath); BulldozerMovePath bestPath = null; while(!candidates.isEmpty()) { BulldozerMovePath currentPath = candidates.pollFirst(); candidates.addAll(generateChildNodes(currentPath, shortestPathsToCoords)); if(destinationCoords.contains(currentPath.getFinalCoords()) && (bestPath == null || movePathComparator.compare(bestPath, currentPath) > 0)) { bestPath = currentPath; maximumCost = bestPath.getMpUsed() + bestPath.getLevelingCost(); } } return bestPath; }

Target:
public BulldozerMovePath findPathToCoords(Entity entity, Set<Coords> destinationCoords, boolean jump) { BulldozerMovePath startPath = new BulldozerMovePath(entity.getGame(), entity); if(jump && (startPath.getCachedEntityState().getJumpMPWithTerrain() > 0) && !entity.isProne() && !entity.isHullDown() && (entity.getGame().getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_TORNADO_F4)) { startPath.addStep(MoveStepType.START_JUMP); } else if (jump) { return null; } else { if(entity.hasETypeFlag(Entity.ETYPE_INFANTRY)) { startPath.addStep(MoveStepType.CLIMB_MODE_OFF); } else { startPath.addStep(MoveStepType.CLIMB_MODE_ON); } } if(entity.isProne() || entity.isHullDown()) { startPath.addStep(MoveStepType.GET_UP); } Coords closest = getClosestCoords(destinationCoords, entity); if (closest == null) { return null; } movePathComparator = new AStarComparator(closest); maximumCost = Integer.MAX_VALUE; TreeSet<BulldozerMovePath> candidates = new TreeSet<>(movePathComparator); candidates.add(startPath); Map<Coords, BulldozerMovePath> shortestPathsToCoords = new HashMap<>(); shortestPathsToCoords.put(startPath.getFinalCoords(), startPath); BulldozerMovePath bestPath = null; while(!candidates.isEmpty()) { BulldozerMovePath currentPath = candidates.pollFirst(); candidates.addAll(generateChildNodes(currentPath, shortestPathsToCoords)); if(destinationCoords.contains(currentPath.getFinalCoords()) && ((bestPath == null) || (movePathComparator.compare(bestPath, currentPath) > 0))) { bestPath = currentPath; maximumCost = bestPath.getMpUsed() + bestPath.getLevelingCost(); } } return bestPath; }