Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $${
- //---------------------------[ CONFIGURATION - Change strings to suit your needs! ]-------------------------------------
- // Version 1.0.0 by Wehttam664
- // This macro will automatically harvest potatoes, carrots, and wheat.
- // Be sure to have seeds (for wheat), carrots, and/or potatoes in your hotbar!
- // Cover all water in farms with slabs or carpet and start in the X-MINUS,Z-MINUS corner!
- &food = "baked_potato";
- // What food will you be carrying?
- #minhunger = 14;
- // Minimum hunger the player can reach before being auto-fed.
- // Scales from 0-20. Each icon is 2 hunger. (i.e.: 14 is missing 3 chicken legs)
- #dodc = 0;
- // Should the bot auto-disconnect after completion?
- // True = 1, False = 0;
- // TODO: Chest unloading. These do not yet function!
- #cx = 0;
- #cz = 0;
- // Coordinates of the offload chest.
- // Chest should be on the same Y level as the crop (not farmland)!
- //---------------------------[ \/ Only modify below if ABSOLUTLY NECESSARY! \/ ]-------------------------------------
- LOG("&aInitializing &ffield &acrop bot.");
- #xpos = %XPOS%;
- #ypos = %YPOS%;
- #zpos = %ZPOS%;
- #lookdir = 180;
- LOOK(%#lookdir%,90,10t);
- GETIDREL(0,-1,0,&bid);
- IF(%&bid%=="farmland");
- LOG("&aSuccessfully located farmland. Starting harvest...");
- DO;
- LOOK(%#lookdir%,90,10t);
- IF(%HUNGER%<=%#minhunger%)
- DO;
- PICK(%&food%);
- KEY(use);
- UNTIL(%HUNGER%>%#minhunger%);
- ENDIF;
- GETIDREL(0,0,0,&crop);
- IF(%&crop%=="potatoes");
- PICK(%&food%);
- KEY(attack);
- WAIT(5t);
- PICK("potato");
- KEY(use);
- ELSEIF(%&crop%=="carrots");
- PICK(%&food%);
- KEY(attack);
- WAIT(5t);
- PICK("carrot");
- KEY(use);
- ELSEIF(%&crop%=="wheat");
- PICK(%&food%);
- KEY(attack);
- WAIT(5t);
- PICK("wheat_seeds");
- KEY(use);
- ENDIF;
- GETIDREL(1,-1,0,&xpb);
- GETIDREL(-1,-1,0,&xmb);
- GETIDREL(0,-1,1,&zpb);
- GETIDREL(0,-1,-1,&zmb);
- // Z-PLUS is FORWARD!
- IF(((%&zpb%=="farmland") || (%&zpb%=="water") || (%&zpb%=="flowing_water")) && (%#lookdir%==180));
- DO;
- KEYDOWN(forward);
- WAIT(1t);
- KEYUP(forward);
- UNTIL(%#zpos%!=%ZPOS%);
- #lookdir=180;
- ELSEIF(((%&xmb%=="farmland") || (%&xmb%=="water") || (%&xmb%=="flowing_water")) && (%#lookdir%==180));
- DO;
- KEYDOWN(right);
- WAIT(1t);
- KEYUP(right);
- UNTIL(%#xpos%!=%XPOS%);
- #lookdir=0;
- ELSEIF(((%&zmb%=="farmland") || (%&zmb%=="water") || (%&zmb%=="flowing_water")) && (%#lookdir%==0));
- DO;
- KEYDOWN(forward);
- WAIT(1t);
- KEYUP(forward);
- UNTIL(%#zpos%!=%ZPOS%);
- #lookdir=0;
- ELSEIF(((%&xpb%=="farmland") || (%&xpb%=="water") || (%&xpb%=="flowing_water")) && (%#lookdir%==0));
- DO;
- KEYDOWN(left);
- WAIT(1t);
- KEYUP(left);
- UNTIL(%#xpos%!=%XPOS%);
- #lookdir=180;
- ELSE;
- LOG("Done!");
- IF(%#dodc%==1);
- DISCONNECT();
- STOP();
- ELSE;
- STOP();
- ENDIF;
- ENDIF;
- #xpos=%XPOS%;
- #ypos=%YPOS%;
- #zpos=%ZPOS%;
- LOOP;
- ELSE;
- LOG("&cFailed &bto locate farmland! Found &c%&bid%&b!");
- LOG("&cStopped bot!");
- STOP();
- ENDIF;
- // Macro by Wehttam664 (Matt)
- }$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement