Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- path = 16
- direction = 0
- _sleep = 70-path
- function plant()
- turtle.select(1)
- sapling = {}
- sapling, sapling.count = turtle.getItemDetail(1)
- if (sapling.count <= 1) then
- for i = 3,16 do
- if (turtle.getItemDetail(i)) then
- if (turtle.getItemDetail(i).name == sapling.name) then
- turtle.select(i)
- turtle.transferTo(1)
- plant()
- break
- end
- end
- end
- elseif (turtle.detect() == false) then
- turtle.place()
- end
- end
- function detect()
- turtle.select(2)
- if (turtle.compare()) then
- felling()
- else
- plant()
- end
- end
- function felling()
- turtle.dig()
- turtle.forward()
- while (turtle.detectUp()) do
- turtle.digUp()
- turtle.up()
- for i = 1,4 do
- turtle.dig()
- turtle.turnRight()
- end
- end
- goDown()
- end
- function goDown()
- turtle.back()
- while turtle.down() do
- for i = 1,4 do
- turtle.dig()
- turtle.turnRight()
- end
- end
- if (turtle.inspectDown()) then
- local block, type = turtle.inspectDown()
- if (type.name ~= "minecraft:dirt" and type.name ~= "minecraft:grass" and type.name ~= "minecraft:chest") then
- turtle.digDown()
- goDown()
- end
- end
- end
- function pathing()
- for x = 2,path do
- detect()
- if (direction == 1) then
- turtle.turnRight()
- turtle.suck()
- turtle.forward()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- turtle.suck()
- turtle.forward()
- turtle.turnRight()
- end
- detect()
- end
- if (direction == 1) then
- direction = 0
- bank()
- else
- direction = 1
- end
- end
- function bank()
- for z = 3,15 do
- turtle.select(z)
- turtle.transferTo(1)
- if (turtle.dropDown() == false and turtle.getItemCount() > 0) then
- while (true) do
- turtle.turnRight()
- end
- end
- end
- end
- function main()
- while (true) do
- pathing()
- sleep(_sleep)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement