daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --prints true if inventory is full, else false
  2. function isFull()
  3.   for i=3, 16 do
  4.     if turtle.getItemCount(i) == 0 then
  5.       return false
  6.     elseif i == 16 then
  7.       return true
  8.     end
  9.   end
  10. end
  11.  
  12. --uses all fuel in inventory, up to 48 items
  13. function betterRefuel()
  14.   for i = 3, 16 do
  15.     turtle.select(i)
  16.     turtle.refuel(48)
  17.   end
  18.   turtle.select(2)
  19. end
  20.  
  21. --empties inventory if it is full
  22. function emptyInventory()
  23.   if isFull() == false then
  24.     return
  25.   end
  26.  
  27.   betterRefuel()
  28.  
  29.   turtle.select(2)
  30.   turtle.placeDown()
  31.   for i = 3, 16 do
  32.     turtle.select(i)  
  33.     turtle.dropDown(64)
  34.   end
  35.  
  36.   turtle.select(2)
  37.   turtle.digDown()
  38. end
  39.  
  40. --moves forward but also digs
  41. function betterMove()
  42.   turtle.dig()
  43.   turtle.forward()
  44.   turtle.digUp()
  45.   turtle.digDown()
  46.   emptyInventory()
  47. end
  48.  
  49. function farmLine(n)
  50.   for i=1, n do
  51.     betterMove()
  52.   end
  53. end
  54.  
  55. function right()
  56.   turtle.turnRight()
  57.   betterMove()
  58.   turtle.turnRight()
  59. end
  60.  
  61. function left()
  62.   turtle.turnLeft()
  63.   betterMove()
  64.   turtle.turnLeft()
  65. end
  66.  
  67. function placeLoaderUp()
  68.   turtle.digUp()
  69.   turtle.select(1)
  70.   turtle.placeUp()
  71. end
  72.  
  73. function placeLoader()
  74.   turtle.dig()
  75.   turtle.select(1)
  76.   turtle.place()
  77. end
  78.  
  79. function firstThreeLines()
  80.   farmLine(15)
  81.   placeLoaderUp()
  82.   turtle.turnRight()
  83.   farmLine(15)
  84.   turtle.turnRight()
  85.   farmLine(15)
  86. end
  87.  
  88. function remainingLines()
  89.   for i = 1, 14 do
  90.     if i%2 == 1 then
  91.       right()
  92.     else
  93.       left()
  94.     end
  95.   end
  96. end
  97.  
  98. function reAlign()
  99.   turtle.turnRight()
  100.   betterMove()
  101.   turtle.turnRight()
  102.   for i=1, 15 do
  103.     turtle.forward()
  104.   end
  105. end
  106.  
  107. function transition()
  108.   turtle.turnRight()
  109.   placeLoader()
  110.   turtle.turnLeft()
  111.   turtle.digUp()
  112.   turtle.up()
  113.   turtle.dig()
  114.   placeLoader()
  115.   turtle.down()
  116.   turtle.forward()
  117.   turtle.turnRight()
  118.   betterMove()
  119.   turtle.turnRight()
  120.   turtle.dig()
  121.   turtle.turnRight()
  122.   turtle.forward()
  123.   turtle.turnRight()
  124. end
  125.  
  126. function farmChunkLayer()
  127.   firstThreeLines()
  128.   remainingLines()
  129.   reAlign()
  130.   transition()
  131. end
  132.  
  133. while true do
  134.   farmChunkLayer()
  135. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top