Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function waitsome(j)
- local k=j
- for i=1,j do
- shell.run("clear")
- print("Time to next run: "..k)
- k=j-i
- sleep(1)
- end
- end
- function getwood()
- turtle.select(2)
- turtle.suckDown(1)
- end
- function getbone()
- turtle.select(10)
- turtle.suckUp(64)
- end
- function refuel()
- if turtle.getFuelLevel() < 600 then
- print("Refueling ...")
- turtle.select(16)
- if turtle.refuel(0) == false then
- turtle.suck(7)
- turtle.refuel(7)
- else
- turtle.refuel(7)
- end
- end
- print("New fuel level:"..turtle.getFuelLevel())
- sleep(0.5)
- end
- function getsapl()
- print("Loading sapplings ...")
- turtle.select(1)
- turtle.turnLeft()
- turtle.suck(12)
- sleep(0.5)
- turtle.turnLeft()
- sleep(0.5)
- end
- function cleanup()
- for i=1,10 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(16)
- turtle.drop()
- end
- function bonemeal()
- local k=0
- print("Attempting to use bonemeal ...")
- turtle.select(2)
- if turtle.compare() == false then
- while k == 0 do
- k=0
- if turtle.getItemCount(10) > 0 then
- turtle.select(10)
- print("Using bonemeal ...")
- turtle.place()
- else
- print("Out of bonemeal! ...")
- k=1
- end
- turtle.select(2)
- if turtle.compare() == true then
- print("Tree successfully grew ...")
- k=1
- else
- print("Tree didn't grow ...")
- k=0
- end
- if k == 1 then
- print("Exiting bonemealing ...")
- else
- print("Attempt failed, reapplying bonemeal ...")
- end
- end
- else
- print("Bonemeal wasn't needed. Continueing ...")
- end
- end
- function choptree()
- turtle.turnRight()
- sleep(0.5)
- bonemeal()
- turtle.select(2)
- if turtle.compare() == true then
- print("Chopping tree ...")
- turtle.dig()
- sleep(0.5)
- turtle.forward()
- sleep(0.5)
- turtle.select(2)
- while turtle.compareUp() == true do
- turtle.digUp()
- sleep(0.5)
- turtle.up()
- end
- while turtle.detectDown() == false do
- turtle.down()
- sleep(0.5)
- end
- turtle.up()
- turtle.select(1)
- turtle.placeDown()
- turtle.turnLeft()
- sleep(0.5)
- turtle.turnLeft()
- sleep(0.5)
- turtle.forward()
- sleep(0.5)
- turtle.down()
- sleep(0.5)
- turtle.turnRight()
- else
- turtle.turnLeft()
- print("din't access choptree ...")
- end
- end
- function forward()
- j=0
- while j ~=11 do
- if turtle.detect() == false then
- turtle.forward()
- end
- for i=11,15 do
- turtle.select(i)
- if turtle.compareDown() == true then
- j=i
- end
- end
- print("Selected turtle slot: "..j)
- if j == 12 then
- choptree()
- end
- if j == 13 then
- turtle.turnRight()
- end
- if j == 14 then
- turtle.turnLeft()
- end
- if j == 15 then
- cleanup()
- end
- sleep(0.5)
- if j ~= 11 then
- j=0
- end
- end
- end
- while true do
- if redstone.getInput("right") == true then
- shell.run("clear")
- refuel()
- getbone()
- getwood()
- getsapl()
- forward()
- waitsome(150)
- else
- shell.run("clear")
- print("off")
- end
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement