Advertisement
Pandana

Tree Chopper

Jul 22nd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. height = 0
  2.  
  3. function checkFuel()
  4.     if turtle.getFuelLevel() >= 14 then
  5.         return true
  6.     else
  7.         return false
  8.     end
  9. end
  10.  
  11. function sortInv()
  12.     for x=1, 16 do
  13.         turtle.select(x)
  14.         if turtle.getItemDetail().name == "Spruce Sapling" then
  15.             turtle.transferTo(16)
  16.         end
  17.     end
  18. end
  19.  
  20. function harvestTree()
  21.     if fuelCheck() == true then
  22.         turtle.moveDown()
  23.         turtle.dig()
  24.         turtle.moveUp()
  25.         sortInv()
  26.         turtle.select(16)
  27.         turtle.place()
  28.         while turtle.detect() do
  29.             turtle.dig()
  30.             if turtle.detectUp() then
  31.                 turtle.digUp()
  32.             end
  33.             turlle.moveUp()
  34.             height = height + 1
  35.         end
  36.         for x=1, height do
  37.             turtle.moveDown()
  38.             height = height -1
  39.         end
  40.     end
  41. end
  42.  
  43. while turtle.detect() do
  44.     harvestTree()
  45.     sleep(1)
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement