SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local function harvest() |
| 1 | + | local function findSlot() |
| 2 | - | turtle.dig() |
| 2 | + | for i = 1, 16 do |
| 3 | if turtle.getItemSpace(i) > 0 then | |
| 4 | - | |
| 4 | + | turtle.select(i) |
| 5 | - | local function plant() |
| 5 | + | return |
| 6 | - | turtle.select(1) |
| 6 | + | end |
| 7 | - | turtle.place() |
| 7 | + | end |
| 8 | end | |
| 9 | - | |
| 9 | + | |
| 10 | while true do | |
| 11 | - | local success, data = turtle.inspect() |
| 11 | + | local isBlock, data = turtle.inspect() |
| 12 | - | if success then |
| 12 | + | if isBlock then |
| 13 | - | if data.state.age == 7 then |
| 13 | + | if data.state and data.state.age == 7 then |
| 14 | - | harvest() |
| 14 | + | findSlot() |
| 15 | - | plant() |
| 15 | + | turtle.dropUp() |
| 16 | turtle.dig() | |
| 17 | - | end |
| 17 | + | end |
| 18 | - | end |
| 18 | + | else |
| 19 | turtle.place() | |
| 20 | end | |
| 21 | turtle.turnRight() | |
| 22 | sleep(30) | |
| 23 | end |