Advertisement
Sanwi

GenericCropBot

Aug 18th, 2014
1,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. $${
  2.  
  3. // Configure #north and #south to the very edge of the field.
  4. // Leave 1 block in each direction on level with the field, so you don't fall off.
  5. // Start at the North-East end of the field. The bot will pick in rows from north to south, then slide west for the next row.
  6. // #toolslot is the slot used to break the crops. Put a fortune 3 tool in the slot to get more carrots or potatoes.
  7. // &plant is the item used to replant (e.g. "wheat_seeds","carrot","potato")
  8. // &mode changes the bot's behavior. "default" will harvest a row, then replant it, and repeat. "plant" will plant without harvesting
  9. // and "harvest" will harvest without planting.
  10.  
  11. // Config
  12.  
  13. #north = 3230
  14. #south = 3260
  15. #toolslot = 8
  16. &plant = "carrot"
  17. &mode = "default"
  18. #wait = 100
  19.  
  20. // End Config
  21.  
  22. slot(1);
  23.  
  24. do;
  25. if(%ZPOS% = %#south%);
  26. #dest = %#north%
  27. // Throw wheat & seeds
  28. look(180,-40);
  29. gui(inventory);
  30. wait(500ms);
  31. for(#forthrow,9,26);
  32. slotclick(%#forthrow%);
  33. wait(%#wait%ms);
  34. slotclick(-999);
  35. wait(%#wait%ms);
  36. next;
  37. gui();
  38. look(90,90);
  39. else;
  40. #dest = %#south%
  41. look(270,90);
  42. endif;
  43.  
  44. do;
  45. keydown(left);
  46. do;
  47. // Mode
  48. if(%&mode% = "plant")
  49. set(plant);
  50. elseif(%&mode% = "harvest")
  51. unset(plant);
  52. elseif(%&mode% = "default")
  53. if(%#dest% = %#south%);
  54. look(270,90);
  55. unset(plant);
  56. else;
  57. look(90,90);
  58. set(plant);
  59. endif;
  60. endif;
  61.  
  62. // If planting
  63. if(plant);
  64. if(%&plant% = "wheat_seeds");
  65. // If item is seeds and stack size >5
  66. if((%ITEM% = %&plant%) && (%STACKSIZE% > 5))
  67. key(use);
  68. else;
  69. keyup(left);
  70. do;
  71. // If no stacks on hotbar >5
  72. if(%INVSLOT% = 9);
  73. // Get more seeds
  74. gui(inventory);
  75. wait(500ms);
  76. for(#cfor,9,35);
  77. getslot(%&plant%,#cslot,%#cfor%);
  78. if(%#cslot% < 36)
  79. slotclick(%#cslot%,1,true);
  80. endif;
  81. wait(%#wait%ms);
  82. next;
  83. gui();
  84. wait(500ms);
  85. slot(1);
  86. else;
  87. inventoryup(1);
  88. endif;
  89. until((%ITEM% = %&plant%) && (%STACKSIZE% > 5))
  90. keydown(left);
  91. endif;
  92. else;
  93. pick("%&plant%");
  94. key(use);
  95. endif;
  96. // else pick
  97. else;
  98. slot(%#toolslot%);
  99. key(attack);
  100. endif;
  101. #cz = %ZPOS%
  102. while(%ZPOS% != %#cz%);
  103. until(%ZPOS% = %#dest%);
  104.  
  105. keyup(left);
  106. keyup(right);
  107.  
  108. #cx = %XPOS%
  109. if((%#dest% = %#north%) || (plant) || (%&mode% = "harvest"));
  110. do;
  111. look(90,90);
  112. keydown(sneak);
  113. keydown(back);
  114. until(%#cx% != %XPOS%);
  115. endif;
  116.  
  117. keyup(sneak);
  118. keyup(back);
  119. keyup(forward);
  120.  
  121. loop;
  122.  
  123. }$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement