Advertisement
Wehttam664

Minecraft field bot v1.0.0

Mar 15th, 2014
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $${
  2. //---------------------------[ CONFIGURATION - Change strings to suit your needs!  ]-------------------------------------
  3. // Version 1.0.0 by Wehttam664
  4. // This macro will automatically harvest potatoes, carrots, and wheat.
  5. // Be sure to have seeds (for wheat), carrots, and/or potatoes in your hotbar!
  6. // Cover all water in farms with slabs or carpet and start in the X-MINUS,Z-MINUS corner!
  7.  
  8. &food = "baked_potato";
  9.     // What food will you be carrying?
  10.  
  11. #minhunger = 14;
  12.     // Minimum hunger the player can reach before being auto-fed.
  13.     // Scales from 0-20. Each icon is 2 hunger. (i.e.: 14 is missing 3 chicken legs)
  14.  
  15. #dodc = 0;
  16.     // Should the bot auto-disconnect after completion?
  17.     // True = 1, False = 0;
  18.  
  19. // TODO: Chest unloading. These do not yet function!
  20. #cx = 0;
  21. #cz = 0;
  22.     // Coordinates of the offload chest.
  23.     // Chest should be on the same Y level as the crop (not farmland)!
  24.  
  25. //---------------------------[  \/  Only modify below if ABSOLUTLY NECESSARY!  \/  ]-------------------------------------
  26. LOG("&aInitializing &ffield &acrop bot.");
  27. #xpos = %XPOS%;
  28. #ypos = %YPOS%;
  29. #zpos = %ZPOS%;
  30. #lookdir = 180;
  31. LOOK(%#lookdir%,90,10t);
  32. GETIDREL(0,-1,0,&bid);
  33. IF(%&bid%=="farmland");
  34.     LOG("&aSuccessfully located farmland. Starting harvest...");
  35.     DO;
  36.         LOOK(%#lookdir%,90,10t);
  37.         IF(%HUNGER%<=%#minhunger%)
  38.             DO;
  39.                 PICK(%&food%);
  40.                 KEY(use);
  41.             UNTIL(%HUNGER%>%#minhunger%);
  42.         ENDIF;
  43.         GETIDREL(0,0,0,&crop);
  44.         IF(%&crop%=="potatoes");
  45.             PICK(%&food%);
  46.             KEY(attack);
  47.             WAIT(5t);
  48.             PICK("potato");
  49.             KEY(use);
  50.         ELSEIF(%&crop%=="carrots");
  51.             PICK(%&food%);
  52.             KEY(attack);
  53.             WAIT(5t);
  54.             PICK("carrot");
  55.             KEY(use);
  56.         ELSEIF(%&crop%=="wheat");
  57.             PICK(%&food%);
  58.             KEY(attack);
  59.             WAIT(5t);
  60.             PICK("wheat_seeds");
  61.             KEY(use);
  62.         ENDIF;
  63.         GETIDREL(1,-1,0,&xpb);
  64.         GETIDREL(-1,-1,0,&xmb);
  65.         GETIDREL(0,-1,1,&zpb);
  66.         GETIDREL(0,-1,-1,&zmb);
  67.             // Z-PLUS is FORWARD!
  68.         IF(((%&zpb%=="farmland") || (%&zpb%=="water") || (%&zpb%=="flowing_water")) && (%#lookdir%==180));
  69.             DO;
  70.                 KEYDOWN(forward);
  71.                 WAIT(1t);
  72.                 KEYUP(forward);
  73.             UNTIL(%#zpos%!=%ZPOS%);
  74.             #lookdir=180;
  75.         ELSEIF(((%&xmb%=="farmland") || (%&xmb%=="water") || (%&xmb%=="flowing_water")) && (%#lookdir%==180));
  76.             DO;
  77.                 KEYDOWN(right);
  78.                 WAIT(1t);
  79.                 KEYUP(right);
  80.             UNTIL(%#xpos%!=%XPOS%);
  81.             #lookdir=0;
  82.         ELSEIF(((%&zmb%=="farmland") || (%&zmb%=="water") || (%&zmb%=="flowing_water")) && (%#lookdir%==0));
  83.             DO;
  84.                 KEYDOWN(forward);
  85.                 WAIT(1t);
  86.                 KEYUP(forward);
  87.             UNTIL(%#zpos%!=%ZPOS%);
  88.             #lookdir=0;
  89.         ELSEIF(((%&xpb%=="farmland") || (%&xpb%=="water") || (%&xpb%=="flowing_water")) && (%#lookdir%==0));
  90.             DO;
  91.                 KEYDOWN(left);
  92.                 WAIT(1t);
  93.                 KEYUP(left);
  94.             UNTIL(%#xpos%!=%XPOS%);
  95.             #lookdir=180;
  96.         ELSE;
  97.             LOG("Done!");
  98.             IF(%#dodc%==1);
  99.                 DISCONNECT();
  100.                 STOP();
  101.             ELSE;
  102.                 STOP();
  103.             ENDIF;
  104.         ENDIF;
  105.         #xpos=%XPOS%;
  106.         #ypos=%YPOS%;
  107.         #zpos=%ZPOS%;
  108.     LOOP;
  109. ELSE;
  110.     LOG("&cFailed &bto locate farmland! Found &c%&bid%&b!");
  111.     LOG("&cStopped bot!");
  112.     STOP();
  113. ENDIF;
  114. // Macro by Wehttam664 (Matt)
  115. }$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement