Lyqyd

Bore

Mar 21st, 2014
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local function refuel()
  2.     turtle.select(15)
  3.     turtle.placeUp()
  4.     turtle.suckUp()
  5.     turtle.refuel()
  6.     turtle.digUp()
  7.     turtle.select(1)
  8. end
  9.  
  10. local function drop()
  11.     turtle.select(16)
  12.     turtle.placeUp()
  13.     for i = 1, 14 do
  14.         turtle.select(i)
  15.         turtle.dropUp()
  16.     end
  17.     turtle.select(16)
  18.     turtle.digUp()
  19.     turtle.select(1)
  20. end
  21.  
  22. local function checkAndDrop()
  23.     local needDrop = true
  24.     for i = 1, 14 do
  25.         if turtle.getItemCount(i) == 0 then
  26.             needDrop = false
  27.         end
  28.     end
  29.     if needDrop then
  30.         drop()
  31.     end
  32. end
  33.  
  34. if turtle.getItemCount(15) == 1 or turtle.getItemCount(16) == 1 and not (turtle.getItemCount(15) == 1 and turtle.getItemCount(16) == 1) then
  35.     --exactly one of our ender chests was in use.
  36.     if turtle.getItemCount(15) == 1 then
  37.         drop()
  38.     else
  39.         refuel()
  40.     end
  41. end
  42.  
  43. while true do
  44.     if turtle.getFuelLevel() == 0 then
  45.         refuel()
  46.     end
  47.     turtle.dig()
  48.     checkAndDrop()
  49.     turtle.forward()
  50.     turtle.digUp()
  51.     checkAndDrop()
  52.     turtle.digDown()
  53.     checkAndDrop()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment