mdc_tjc icon

mc_glean

mdc_tjc | PRO | 04/11/15 07:40:39 PM UTC | 0 ⭐ | 426 👁️ | Never ⏰ | []
Lua |

720 B

|

None

|

0 👍

/

0 👎

-- This program will break blocks below it matching the block in slot # 1 and then return to the starting point
 
local moveFwd = 0
 
local function tryMoveFwd()
    while turtle.detect() do
        if turtle.dig() then
        sleep(0.05)
        end
    end
    turtle.forward(1)
    moveFwd = moveFwd + 1
end
 
-- This is the main process loop of the program where blocks are checked and broken
 
turtle.select( 1 )
if turtle.getItemCount() < 1 then
    print("please place desired harvest block in slot # 1")
    return
end
 
while turtle.compareDown() do
    turtle.digDown()
    tryMoveFwd()
end
 
-- the next section returns the turtle to its starting point
 
for i = 1, moveFwd do
    turtle.back()
end

Comments