Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg = {...}
- local crop = arg[1]
- local timeout = 800
- local cycles = 0
- local length = 0
- local travel = 0
- while true do
- local success, data = turtle.inspectDown()
- if data.state ~= nil then
- if data.name == 'minecraft:stone' then
- turtle.turnRight()
- end
- if data.name == 'minecraft:planks' then
- turtle.turnLeft()
- end
- if data.name == 'minecraft:stonebrick' then
- print('Found a stone block! Unloading and sleeping '..timeout..' seconds...')
- if turtle.detectUp() then
- for n = 3, 16, 1 do
- turtle.select(n)
- turtle.dropUp()
- end
- end
- sleep(timeout)
- cycles = cycles + 1
- length = math.max(length, travel)
- print (cycles..' CYCLE')
- if turtle.getItemCount(1) < length/80 then
- print('Waiting for fuel')
- end
- while turtle.getItemCount(1) < length/80 do
- sleep(1)
- end
- end
- if data.state.age == 7 then
- print('Found a grown crop! Harvesting...')
- turtle.digDown('right')
- end
- end
- if not turtle.detectDown() then
- print('Is this an empty spot? Tilling and replanting...')
- turtle.digDown('right')
- turtle.select(2)
- turtle.placeDown()
- end
- if turtle.getFuelLevel() < 1 then
- print('Out of fuel! Refuelling...')
- turtle.select(1)
- turtle.refuel(1)
- end
- turtle.forward()
- travel = travel + 1
- end
Add Comment
Please, Sign In to add comment