Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local saplings = 1 -- the slot where the saplings are
- local log = 2
- local fuel = 3
- function getSaplings(slot)
- turtle.select(slot)
- local need = 64 - turtle.getItemCount()
- if (need >= 20) then
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.suck(need)
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- end
- end
- function getFuel(slot)
- turtle.select(slot)
- local need = 64 - turtle.getItemCount()
- print("Need ",need," more fuel")
- if (need >= 20) then
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.suck(need)
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- end
- end
- while turtle.getItemCount(saplings) > 0 do -- while more saplings in inventory
- if turtle.getFuelLevel() < 30 then
- turtle.select(fuel)
- turtle.refuel(2)
- end
- getFuel(fuel)
- for i = 1, 7 do -- plant 8 saplings in a row
- turtle.turnLeft()
- turtle.select(log)
- if turtle.compare() then
- turtle.dig()
- end
- turtle.select(saplings)
- turtle.place()
- turtle.turnRight()
- turtle.forward()
- end
- -- turn around and line up for next pass
- turtle.turnRight()
- turtle.turnRight()
- for i = 1, 7 do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- getSaplings(saplings)
- sleep(30) -- sleep for 30 seconds to allow trees to grow
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement