Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Author: ArbitraryHubris
- -- place saplings in slot 1, bone meal in slot 2
- unknown, saplings = 0, 1
- local function plantSaplings()
- -- clear and plant logs in 2x2 layout and return to starting position
- print("Planting saplings")
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- turtle.dig()
- turtle.place()
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- turtle.dig()
- turtle.place()
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.select(2)
- turtle.place()
- print("Saplings planted")
- end
- local function detectItem()
- turtle.select(saplings)
- if turtle.compare() then
- -- print("Detected sapling")
- return saplings
- end
- return unknown
- end
- local function fell()
- height = 0
- turtle.dig()
- turtle.forward()
- while turtle.detectUp() do
- height = height + 1
- turtle.digUp()
- turtle.dig()
- turtle.up()
- end
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- while height > 0 do
- turtle.dig()
- turtle.digDown()
- turtle.down()
- height = height - 1
- end
- turtle.down()
- turtle.dig()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- for i = 3,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function waitForTree()
- seconds = 0
- while true do
- print("Waiting for sapling to grow for " .. seconds .. " seconds")
- os.sleep(10)
- seconds = seconds + 10
- if detectItem() ~= saplings then
- return
- end
- end
- end
- while true do
- plantSaplings()
- waitForTree()
- fell()
- end
Advertisement
Add Comment
Please, Sign In to add comment