Lxr3517

lumber

Nov 30th, 2020
514
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function fuelCheck()
  2.   local fuelLevel = turtle.getFuelLevel()
  3.   if fuelLevel < 20 then
  4.     turtle.select(1)
  5.     turtle.refuel(1)
  6.     print("Refueled!")
  7.   end
  8. end
  9.  
  10. function chopTree()
  11.   local success, data = turtle.inspect()
  12.   if data.name == "minecraft:log" then
  13.     print("Tree detected... chopping.")
  14.     turtle.dig()
  15.     turtle.forward()
  16.     while turtle.detectUp() == true do
  17.       turtle.digUp()
  18.       turtle.up()
  19.     end
  20.     while turtle.detectDown() == false do
  21.       turtle.down()
  22.     end
  23.     turtle.back()
  24.     turtle.select(3)
  25.     turtle.place()
  26.     turtle.select(1)
  27.   end
  28. end
  29.  
  30. local chopping = true
  31. while chopping do
  32.   fuelCheck()
  33.   chopTree()
  34.   turtle.suck()
  35.   turtle.suckUp()
  36. end
  37.  
RAW Paste Data