Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- itemWhitelist = {"coal","redstone","lapis","diamond","emerald","ore"}
- function has(t,s)
- for i,k in pairs(t) do
- if s:find(k) then
- return true
- end
- end
- return false
- end
- function getName(sBelowAbove)
- if sBelowAbove == "below" then
- _,itemDetails = turtle.inspectDown()
- elseif sBelowAbove == "above" then
- _,itemDetails = turtle.inspectUp()
- else
- _,itemDetails = turtle.inspect()
- end
- if type(itemDetails) == "table" then
- if itemDetails.name then
- return itemDetails.name
- else
- return ""
- end
- end
- end
- function emptyJunk()
- for i=16,1,-1 do
- local itemDetails = turtle.getItemDetail(i)
- if type(itemDetails) == "table" then
- if itemDetails.name then
- if not has(itemWhitelist,itemDetails.name) then
- print("Pruned " .. turtle.getItemCount(i) .. " " .. itemDetails.name)
- turtle.select(i)
- turtle.dropUp()
- end
- end
- end
- end
- turtle.select(1)
- end
- function digHole()
- local distanceDown = 0
- while true do
- turtle.digDown()
- if turtle.down() then
- distanceDown = distanceDown + 1
- else
- break
- end
- for i=1,4 do
- turtle.dig()
- turtle.turnLeft()
- end
- emptyJunk()
- end
- print("Returning to surface")
- for i=distanceDown,1,-1 do
- turtle.up()
- end
- end
- s = 0
- a = {...}
- l = a[1]
- for i=1,l do
- for j=1,l do
- digHole()
- turtle.forward()
- turtle.forward()
- end
- if s == 0 then
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- s = 1
- else
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- s = 0
- end
- end
- digHole()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement