Advertisement
Guest User

farm

a guest
Apr 26th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.78 KB | None | 0 0
  1. local lastTurn = "Left"
  2. local itemNumber = 1231
  3. local width = 7
  4. local length = 7
  5. local areaOfFarm = width * length
  6. print("Running")
  7.  
  8. while true do
  9. for i = 0,width -1 do
  10.   for x = 0, length -1 do
  11.       local success, data = turtle.inspectDown()
  12.         if success then
  13.           if data.metadata == 7 then
  14.             turtle.digDown()
  15.           end
  16.        end
  17.     if turtle.inspectDown() ~= itemNumber then
  18.       turtle.select(1)
  19.       turtle.placeDown()
  20.     end
  21.     turtle.forward()
  22.   end
  23.   if lastTurn == "Left" and i ~= 6 then
  24.     turtle.turnRight()
  25.     turtle.forward()
  26.     turtle.turnRight()
  27.     lastTurn = "Right"
  28.       local success, data = turtle.inspectDown()
  29.         if success then
  30.           if data.metadata == 7 then
  31.             turtle.digDown()
  32.           end
  33.        end
  34.       if turtle.inspectDown() ~= itemNumber then
  35.         turtle.select(1)
  36.         turtle.placeDown()
  37.       end
  38.   elseif lastTurn == "Right" and i ~= 6 then
  39.     turtle.turnLeft()
  40.     turtle.forward()
  41.     turtle.turnLeft()
  42.     lastTurn = "Left"
  43.     local success, data = turtle.inspectDown()
  44.     if success then
  45.       if data.metadata == 7 then
  46.         turtle.digDown()
  47.       end
  48.     end
  49.     if turtle.inspectDown() ~= itemNumber then
  50.       turtle.select(1)
  51.       turtle.placeDown()
  52.     end
  53.   end
  54. end
  55.   for y=0, length -1 do
  56.     turtle.back()
  57.   end
  58.   turtle.turnLeft()
  59.   for y = 0, width -2 do
  60.     turtle.forward()
  61.   end
  62.  
  63.   for t = 1, 16 do
  64.     turtle.select(t)
  65.     turtle.drop()
  66.   end
  67.   turtle.turnLeft()
  68.   turtle.select(1)
  69.   turtle.suck(areaOfFarm)
  70.  
  71.   if turtle.getFuelLevel() < 200 then
  72.     turtle.suckUp(16)
  73.     turtle.refuel()
  74.   end
  75.  
  76.   turtle.turnLeft()
  77.   turtle.turnLeft()
  78.   --print("Yay")
  79.   sleep(120)
  80.   --print("More yay")
  81.   turtle.select(1)
  82.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement