Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turtle.select(1)
- function check_inventory()
- local all_empty = false
- local data = turtle.getItemDetail(turtle.getSelectedSlot())
- while (turtle.getItemCount(turtle.getSelectedSlot())) <= 0 or (data.name == "minecraft:magma_block") do
- print('Moving slot')
- if turtle.getSelectedSlot() >= 16 then
- turtle.select(1)
- if all_empty then
- print('All inventory slots empty, shutting down')
- exit()
- end
- all_empty = true
- end
- turtle.select(turtle.getSelectedSlot()+1)
- data = turtle.getItemDetail(turtle.getSelectedSlot())
- end
- end
- bigSleep = false
- side = read()
- while true do
- while turtle.detect() do
- sleep(0.5)
- bigSleep = true
- end
- if bigSleep then
- sleep(5.0)
- bigSleep = false
- end
- check_inventory()
- if side == "l" then
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.forward()
- else
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- turtle.forward()
- end
- end
Add Comment
Please, Sign In to add comment