Advertisement
DonnyKerstens

TreeFarm

Nov 27th, 2020 (edited)
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1.  
  2. function cutTree()
  3.     print("Cutting tree")
  4.     turtle.dig()
  5.     turtle.forward()
  6.     local succes, Block = turtle.inspectUp()
  7.     while(Block.name == "minecraft:log") do
  8.         turtle.digUp()
  9.         turtle.up()
  10.         succes, Block = turtle.inspectUp()
  11.     end
  12.     while(turtle.detectDown() == false) do
  13.         turtle.down()
  14.     end
  15.     turtle.forward()
  16.     turtle.forward()
  17. end
  18.  
  19.  
  20. function goOver()
  21.     turtle.up()
  22.     turtle.forward()
  23.     turtle.forward()
  24.     turtle.down()
  25.     turtle.forward()
  26. end
  27.  
  28.  
  29. function nextLaneLeft()
  30.     turtle.turnLeft()
  31.     turtle.forward()
  32.     turtle.forward()
  33.     turtle.forward()
  34.     turtle.turnLeft()
  35. end
  36.  
  37.  
  38. function nextLaneRight()
  39.     turtle.turnRight()
  40.     turtle.forward()
  41.     turtle.forward()
  42.     turtle.forward()
  43.     turtle.turnRight()
  44. end
  45.  
  46.  
  47. function collum()
  48.     for i=1, 3, 1 do
  49.         local oke, log = turtle.inspect()
  50.         if(log.name == "minecraft:log") then
  51.             cutTree()
  52.         else
  53.             goOver()
  54.         end
  55.     end
  56. end
  57. function patrol()
  58.     turtle.forward()
  59.     collum()
  60.     nextLaneLeft()
  61.     collum()
  62.     nextLaneRight()
  63.     collum()
  64. end
  65.  
  66. patrol()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement