Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function reOrganiseInv()
- for i=3,16 do
- if turtle.getItemCount(i)==0 then
- if i+1<16
- turtle.select(i+1)
- turtle.transferTo(i)
- end
- else
- for o=i,16 do
- turtle.select(i)
- if turtle.compareTo(o) then
- turtle.select(o)
- turtle.transferTo(i)
- end
- end
- end
- end
- end
- function reFuel()
- if turtle.getFuelLevel() <= 200 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- function remainingSlots()
- emptySlots =0
- for i=1,16 do
- if turtle.getItemCount(i)==0 then
- emptySlots=emptySlots+1
- end
- end
- return emptySlots
- end
- function backTrack()
- turtle.turnLeft()
- turtle.turnLeft()
- count =0
- repeat
- count = count+1
- local success, data = turtle.forward()
- if success then
- end
- if count%5==0 then
- turtle.turnLeft()
- turtle.select(2)
- turtle.place()
- turtle.turnRight()
- turtle.select(1)
- end
- until not success
- end
- function clearSpace()
- turtle.turnLeft()
- turtle.turnLeft()
- dropCount=0
- for i=1,16 do
- local data = turtle.getItemDetail(i)
- if data then
- if data.name =="minecraft:cobblestone" then
- turtle.select(i)
- turtle.drop()
- dropCount=dropCount+1
- end
- end
- end
- if dropCount ==0 then
- backTrack()
- exit()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function tunnelV2(x)
- for i = 1,x do
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.up()
- turtle.dig()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.down()
- turtle.dig()
- turtle.turnLeft()
- reFuel()
- if remainingSlots()== 0 then
- clearSpace()
- end
- end
- backTrack()
- end
- local args={...}
- x=args[1]
- y=args[2]
- for i=1,y do
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- if i%5==0 then
- print("i is : ",i)
- turtle.turnLeft()
- tunnelV2(x)
- turtle.turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement