Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local invalid = true
- local width = 2
- local height = 0
- function chop()
- turtle.select(1)
- if width == 2 then
- if turtle.detect() then
- repeat turtle.dig() until turtle.forward()
- end
- while turtle.detect() do
- turtle.dig()
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.turnLeft()
- if turtle.detectUp() then
- turtle.digUp()
- repeat until turtle.up()
- height=height+1
- end
- end
- repeat until turtle.forward()
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- repeat until turtle.forward()
- turtle.turnLeft()
- for i=1,height do
- repeat turtle.digDown() until turtle.down()
- end
- end
- repeat until turtle.back()
- turtle.turnRight()
- repeat until turtle.back()
- turtle.turnLeft()
- repeat until turtle.back()
- end
- function replant()
- for i=1,15 do
- turtle.select(i)
- if turtle.compareTo(16) and turtle.getItemCount(i) >3 then
- repeat until turtle.up()
- for i=1,2 do
- repeat until turtle.forward()
- turtle.placeDown()
- end
- for i=1,2 do
- turtle.turnRight()
- repeat until turtle.forward()
- turtle.placeDown()
- end
- repeat until turtle.forward()
- turtle.turnRight()
- repeat until turtle.forward()
- repeat until turtle.down()
- turtle.turnRight()
- break
- end
- end
- print("Ran out of saplings!")
- end
- function refuel()
- if turtle.getFuelLevel() < 200 then
- for i=1,15 do
- turtle.select(i)
- if not turtle.compareTo(16) then
- turtle.refuel()
- end
- end
- end
- end
- function empty()
- turtle.turnRight()
- for i=1,15 do
- turtle.select(i)
- if not turtle.compareTo(16) then
- turtle.drop()
- end
- end
- turtle.turnLeft()
- end
- while true do
- turtle.select(16)
- print("Has the tree grown yet?")
- if not turtle.compare() then
- print("w00t tree has grown! Lets get wood!")
- height = 0
- chop()
- print("Replanting saplings")
- replant()
- print("Checking fuel and refuelling")
- refuel()
- print("Deposit our wood in the chest")
- empty()
- end
- print("Waiting a minute for the tree to grow")
- sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment