Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- put this where you declare variables:
- private int[][] MinePos = { { 2845, 2968, 0 }, { 2838, 2970, 0 },
- { 2832, 2970, 0 }, { 2829, 2983, 0 }, { 2824, 2997, 0 } };
- put this anywhere:
- public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath,
- int distanceFromEnd) {
- if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0]
- : path[0][0], AscendThroughPath ? path[path.length - 1][1]
- : path[0][1]) <= distanceFromEnd)
- return true;
- else {
- WalkAlongPath(path, AscendThroughPath);
- return false;
- }
- }
- public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
- int destination = 0;
- for (int i = 0; i < path.length; i++)
- if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(
- path[destination][0], path[destination][1]))
- destination = i;
- if (client.getMyPlayer().isMoving()
- && distanceToPoint(path[destination][0], path[destination][1]) > (isRunning() ? 3
- : 2))
- return;
- if (AscendThroughPath && destination != path.length - 1
- || !AscendThroughPath && destination != 0)
- destination += (AscendThroughPath ? 1 : -1);
- try {
- log("Walking to node:" + destination);
- walk(new Position(path[destination][0], path[destination][1], 0));
- Thread.sleep(700 + MethodProvider.random(600));
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- private int distanceToPoint(int pointX, int pointY) {
- return (int) Math.sqrt(Math
- .pow(client.getMyPlayer().getX() - pointX, 2)
- + Math.pow(client.getMyPlayer().getY() - pointY, 2));
- }
- put this where you want to execute the walk:
- try {
- WalkAlongPath(MinePos, true);
- } catch (Exception localException) {
- }
Advertisement
Add Comment
Please, Sign In to add comment