mdc_tjc

mc_glean

Apr 11th, 2015
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. -- This program will break blocks below it matching the block in slot # 1 and then return to the starting point
  2.  
  3. local moveFwd = 0
  4.  
  5. local function tryMoveFwd()
  6.     while turtle.detect() do
  7.         if turtle.dig() then
  8.         sleep(0.05)
  9.         end
  10.     end
  11.     turtle.forward(1)
  12.     moveFwd = moveFwd + 1
  13. end
  14.  
  15. -- This is the main process loop of the program where blocks are checked and broken
  16.  
  17. turtle.select( 1 )
  18. if turtle.getItemCount() < 1 then
  19.     print("please place desired harvest block in slot # 1")
  20.     return
  21. end
  22.  
  23. while turtle.compareDown() do
  24.     turtle.digDown()
  25.     tryMoveFwd()
  26. end
  27.  
  28. -- the next section returns the turtle to its starting point
  29.  
  30. for i = 1, moveFwd do
  31.     turtle.back()
  32. end
Advertisement
Add Comment
Please, Sign In to add comment