Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- branchmine v 1.0
- by AlphaSheepPig
- To use, give the turtle the following:
- Slot 1: Coal
- Slot 2: Cobblestone
- Slot 3: Chests
- Slot 4: Torches
- Turtle will dig a 2 high tunnel for
- 100 blocks, move 5 blocks over, and
- dig a second tunnel back.
- It places torches along the way,
- and places a chest and offloads
- inventory when full.
- ]]
- function placeTorch ()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(4)
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function offLoad ()
- turtle.turnLeft()
- repeat
- sleep(0.5)
- until turtle.dig() == false or turtle.detect() == false
- turtle.forward()
- repeat
- sleep(0.5)
- until turtle.digUp() == false or turtle.detectUp() == false
- turtle.back()
- turtle.select(3)
- turtle.place()
- for slot = 5,16,1 do
- turtle.select(slot)
- turtle.drop()
- end
- turtle.select(5)
- turtle.turnRight()
- end
- function moveOneBlock (i)
- repeat
- sleep(0.5)
- until turtle.dig() == false or turtle.detect() == false
- repeat
- sleep(0.5)
- until turtle.digUp() == false or turtle.detectUp() == false
- turtle.select(2)
- turtle.placeDown()
- if i%13 == 0 then
- placeTorch()
- end
- end
- function checkMaterials()
- for slot = 1,4,1 do
- if turtle.getItemCount(slot) == 0 then
- print("Out of materials")
- exit()
- end
- end
- end
- function mineTunnel (length)
- i = 1
- while i < length do
- moveOneBlock(i)
- if turtle.getFuelLevel() == 0 then
- turtle.select(1)
- turtle.refuel(1)
- end
- if turtle.getItemCount(16) > 0 then
- offLoad()
- end
- if turtle.forward() then
- i = i+1
- end
- checkMaterials()
- end
- end
- function makeMine (x,y)
- -- digs a tunnel x blocks, moves over y blocks, and digs a tunnel back.
- mineTunnel(x)
- placeTorch()
- turtle.turnLeft()
- mineTunnel(y)
- placeTorch()
- turtle.turnLeft()
- mineTunnel(x)
- placeTorch()
- turtle.turnRight()
- mineTunnel(y)
- placeTorch()
- turtle.turnRight()
- end
- while true do
- makeMine(50,4)
- end
Advertisement
Add Comment
Please, Sign In to add comment