Advertisement
Guest User

farm.lua

a guest
Aug 17th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. local radius = 4
  2.  
  3. function farm()
  4.     turtle.digDown()
  5.     turtle.placeDown()
  6.     turtle.forward()
  7. end
  8.  
  9. function emptyInv()
  10.     local suc, chest = turtle.inspect()
  11.     if chest.name == "minecraft:chest" or chest.name == "minecraft:trapped_chest" then
  12.         print("chest found")
  13.         for i=1,15 do
  14.             turtle.select(i)
  15.             turtle.drop(turtle.getItemCount(i))
  16.         end
  17.     end
  18. end
  19.  
  20. function farming()
  21.     local rad = radius
  22.     print("start")
  23.     for i=1,radius do
  24.         print("ring " ..i)
  25.         print(rad*2+1)
  26.         for i=1,4 do
  27.             local bl = 1
  28.             for i=1,rad*2+1 do
  29.                 term.write(bl .." ")
  30.                 bl = bl+1
  31.                 farm()
  32.             end
  33.             print("")
  34.             if rad < 4 then
  35.                 --ABSOLUTLY NO IDEA WHY THIS IS NECASSARY
  36.                 turtle.back()
  37.             end
  38.             if i == 4 then
  39.                 print("compl")
  40.                 turtle.back()
  41.                 turtle.turnLeft()
  42.                 turtle.forward()
  43.             else
  44.                 turtle.turnLeft()
  45.             end
  46.         end
  47.         rad = rad - 1
  48.     end
  49.     for i=1,radius-1 do
  50.         turtle.back()
  51.     end
  52.     turtle.turnRight()
  53.     while turtle.detect() == false do
  54.         turtle.forward()
  55.     end
  56.     emptyInv()
  57.     turtle.turnLeft()
  58. end
  59.  
  60. farming()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement