blahs44

Untitled

Oct 14th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.44 KB | None | 0 0
  1. put this where you declare variables:
  2.  
  3. private int[][] MinePos = { { 2845, 2968, 0 }, { 2838, 2970, 0 },
  4.                         { 2832, 2970, 0 }, { 2829, 2983, 0 }, { 2824, 2997, 0 } };
  5.  
  6.  
  7. put this anywhere:
  8.  
  9. public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath,
  10.                         int distanceFromEnd) {
  11.                 if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0]
  12.                                 : path[0][0], AscendThroughPath ? path[path.length - 1][1]
  13.                                 : path[0][1]) <= distanceFromEnd)
  14.                         return true;
  15.                 else {
  16.                         WalkAlongPath(path, AscendThroughPath);
  17.                         return false;
  18.                 }
  19.         }
  20.  
  21.         public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
  22.                 int destination = 0;
  23.                 for (int i = 0; i < path.length; i++)
  24.                         if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(
  25.                                         path[destination][0], path[destination][1]))
  26.                                 destination = i;
  27.                 if (client.getMyPlayer().isMoving()
  28.                                 && distanceToPoint(path[destination][0], path[destination][1]) > (isRunning() ? 3
  29.                                                 : 2))
  30.                         return;
  31.                 if (AscendThroughPath && destination != path.length - 1
  32.                                 || !AscendThroughPath && destination != 0)
  33.                         destination += (AscendThroughPath ? 1 : -1);
  34.                 try {
  35.                         log("Walking to node:" + destination);
  36.                         walk(new Position(path[destination][0], path[destination][1], 0));
  37.                         Thread.sleep(700 + MethodProvider.random(600));
  38.                 } catch (InterruptedException e) {
  39.                         e.printStackTrace();
  40.                 }
  41.         }
  42.  
  43.         private int distanceToPoint(int pointX, int pointY) {
  44.                 return (int) Math.sqrt(Math
  45.                                 .pow(client.getMyPlayer().getX() - pointX, 2)
  46.                                 + Math.pow(client.getMyPlayer().getY() - pointY, 2));
  47.         }
  48.  
  49.  
  50. put this where you want to execute the walk:
  51.  
  52. try {
  53.                         WalkAlongPath(MinePos, true);
  54.                 } catch (Exception localException) {
  55.                 }
Advertisement
Add Comment
Please, Sign In to add comment