Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local success, data = turtle.inspectDown()
- woodtype = data.name
- print("farming wood type: ", woodtype)
- right = true
- function harvest()
- turtle.select(1)
- local success, data = turtle.inspect()
- wood = data.name
- print(wood)
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- while true do
- local success, data = turtle.inspectUp()
- if data.name == wood then
- turtle.digUp()
- turtle.up()
- else
- break
- end
- end
- while not turtle.detectDown() do
- turtle.down()
- end
- turtle.back()
- end
- function test()
- local success, data = turtle.inspect()
- if data.name == woodtype then
- harvest()
- return true
- end
- return false
- end
- function move()
- while not turtle.detect() do
- turtle.forward()
- end
- if not test() then
- if right then
- turtle.turnRight()
- test()
- turtle.forward()
- test()
- turtle.turnRight()
- right = not right
- else
- turtle.turnLeft()
- test()
- turtle.forward()
- test()
- turtle.turnLeft()
- right = not right
- end
- end
- end
- function main()
- while true do
- move()
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment