Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local blockName = "log"
- function check()
- local success, data = turtle.inspect()
- if success then
- if string.match(data.name,blockName) then
- return true
- end
- print(data.name)
- end
- return false
- end
- function moveLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end
- function moveRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- end
- function harvest()
- m=0
- if check() then
- turtle.dig()
- turtle.forward()
- --local data = turtle.inspectUp()
- while turtle.detectUp() do
- if m > 5 then
- break
- end
- turtle.digUp()
- turtle.up()
- m=m+1
- end
- while not turtle.detectDown() do
- turtle.down()
- end
- turtle.back()
- turtle.select(16)
- turtle.place()
- turtle.select(1)
- end
- end
- function forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- function contains(str,key)
- if string.match(str,key) then
- return true
- end
- return false
- end
- function backToStart()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- for i=0,12 do
- turtle.forward()
- end
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(16)
- turtle.suck()
- turtle.select(1)
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- end
- function farm()
- for k=0,2 do
- for i=0,6 do
- harvest()
- moveLeft()
- harvest()
- end
- forward()
- for i=0,6 do
- harvest()
- moveRight()
- harvest()
- end
- forward()
- end
- backToStart()
- end
- while true do
- farm()
- end
- --backToStart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement