paramus

Tree farm

Jan 16th, 2026
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | Gaming | 0 0
  1. --Simply place the turtle with saplings on the selected slot and start the program. It needs fuel to work
  2.  
  3. function FarmTree()
  4.     local has_block, data = turtle.inspect()
  5.     if (has_block == false or string.find(data.name, "_log") == nil) then
  6.         return
  7.     end
  8.    
  9.     -- Go up and mine
  10.     while (has_block and string.find(data.name, "_log")) do
  11.         turtle.dig()
  12.         turtle.digUp()
  13.         turtle.up()
  14.         has_block, data = turtle.inspect()
  15.     end
  16.    
  17.     -- Return down
  18.     has_block, data = turtle.inspectDown()
  19.     while(has_block == false) do
  20.         turtle.down()
  21.         has_block, data = turtle.inspectDown()
  22.     end
  23.    
  24.     --Replant
  25.     data = turtle.getItemDetail()
  26.     if (string.find(data.name, "_sapling")) then
  27.         turtle.place()
  28.     end
  29. end
  30.  
  31. -- Main
  32. while (true) do
  33.     FarmTree()
  34.     sleep(10)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment