SHOW:
|
|
- or go back to the newest paste.
| 1 | turtle.select(1) | |
| 2 | ||
| 3 | - | ender_chest_slot = 16 |
| 3 | + | |
| 4 | local all_empty = false | |
| 5 | local data = turtle.getItemDetail(turtle.getSelectedSlot()) | |
| 6 | - | local all_empty = false |
| 6 | + | |
| 7 | - | local data |
| 7 | + | while (turtle.getItemCount(turtle.getSelectedSlot())) <= 0 or (data.name == "minecraft:magma_block") do |
| 8 | - | |
| 8 | + | print('Moving slot')
|
| 9 | - | while true do |
| 9 | + | if turtle.getSelectedSlot() >= 16 then |
| 10 | - | data = turtle.getItemDetail(turtle.getSelectedSlot()) |
| 10 | + | turtle.select(1) |
| 11 | - | |
| 11 | + | if all_empty then |
| 12 | - | if data == nil then |
| 12 | + | print('All inventory slots empty, shutting down')
|
| 13 | - | turtle.select(turtle.getSelectedSlot()+1) |
| 13 | + | exit() |
| 14 | - | elseif data.name ~= "minecraft:oak_planks" then |
| 14 | + | end |
| 15 | - | turtle.select(turtle.getSelectedSlot()+1) |
| 15 | + | all_empty = true |
| 16 | - | else |
| 16 | + | end |
| 17 | - | print("Track found in slot ", turtle.getSelectedSlot())
|
| 17 | + | turtle.select(turtle.getSelectedSlot()+1) |
| 18 | - | break |
| 18 | + | data = turtle.getItemDetail(turtle.getSelectedSlot()) |
| 19 | - | end |
| 19 | + | |
| 20 | - | |
| 20 | + | |
| 21 | - | if turtle.getSelectedSlot() >= ender_chest_slot then |
| 21 | + | |
| 22 | - | print("Last searchable slot reached")
|
| 22 | + | |
| 23 | - | turtle.select(1) |
| 23 | + | |
| 24 | - | if all_empty then |
| 24 | + | side = read() |
| 25 | - | break |
| 25 | + | |
| 26 | - | end |
| 26 | + | |
| 27 | - | all_empty = true |
| 27 | + | while turtle.detect() do |
| 28 | - | end |
| 28 | + | |
| 29 | - | end |
| 29 | + | |
| 30 | - | |
| 30 | + | |
| 31 | - | return all_empty |
| 31 | + | |
| 32 | if bigSleep then | |
| 33 | sleep(5.0) | |
| 34 | - | function get_more_rails() |
| 34 | + | |
| 35 | - | local all_empty = false |
| 35 | + | |
| 36 | - | local data |
| 36 | + | |
| 37 | - | turtle.select(ender_chest_slot) |
| 37 | + | check_inventory() |
| 38 | - | turtle.place() |
| 38 | + | |
| 39 | - | turtle.select(1) |
| 39 | + | if side == "l" then |
| 40 | - | |
| 40 | + | turtle.turnLeft() |
| 41 | - | while true do |
| 41 | + | turtle.place() |
| 42 | - | data = turtle.getItemDetail(turtle.getSelectedSlot()) |
| 42 | + | turtle.turnRight() |
| 43 | - | if data == nil then |
| 43 | + | turtle.forward() |
| 44 | - | if turtle.suck(64) == false then |
| 44 | + | else |
| 45 | - | break |
| 45 | + | turtle.turnRight() |
| 46 | - | end |
| 46 | + | turtle.place() |
| 47 | - | elseif data.name ~= "minecraft:oak_planks" then |
| 47 | + | turtle.turnLeft() |
| 48 | - | turtle.dropDown() |
| 48 | + | turtle.forward() |
| 49 | - | if turtle.suck(64) == false then |
| 49 | + | |
| 50 | - | break |
| 50 | + |