Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Program by DreamCoding / DreamGamer
- -- Youtube: /dr34m94m3r
- -- Web: http://DreamGamer.de
- local distance = 0
- local torch = 0
- function startMining(lenght)
- for i1=1, lenght, 1 do
- dig()
- goForward()
- turnRight(1)
- dig()
- digUp()
- goUp()
- dig()
- digUp()
- goUp()
- dig()
- digDown()
- goDown()
- digDown()
- goDown()
- turnLeft(1)
- checkUnderground()
- checkInv()
- checkFuel()
- distance = distance + 1
- torch = torch + 1
- checkLight()
- print("Distance: " .. distance)
- end -- for
- turnLeft(2)
- for i3=1, distance,1 do
- dig()
- goForward()
- end
- turnLeft(2)
- end
- function goDown()
- while turtle.detectDown() do
- turtle.digDown()
- sleep(0.5)
- end
- turtle.down()
- end
- function digUp()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.5)
- end
- end
- function digDown()
- while turtle.detectDown() do
- turtle.digDown()
- sleep(0.5)
- end
- end
- function goUp()
- turtle.up()
- end
- function goForward()
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- turtle.forward()
- end
- function goBack()
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- turtle.back()
- end
- function turnRight(turnNumber)
- for i=1, turnNumber, 1 do
- turtle.turnRight()
- end
- end
- function turnLeft(turnNumber)
- for i=1, turnNumber, 1 do
- turtle.turnLeft()
- end
- end
- function dig()
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- function checkInv()
- if turtle.getItemCount(14) == 0 then
- while turtle.getItemCount(14) == 0 do
- print("Missing Ender chest!")
- sleep(10)
- end
- else
- if turtle.getItemCount(13) > 1 then
- local slot = 2
- turnRight(1)
- turtle.select(14)
- turtle.place()
- print("Clear Inventory...")
- while turtle.getItemCount(13) > 0 do
- if slot < 14 then
- turtle.select(slot)
- sleep(0.2)
- if turtle.detect() then
- turtle.drop(64)
- else
- print("No chest?")
- end -- if
- slot = slot + 1
- else
- print("No Space in Inventory")
- sleep(30)
- slot = 2
- end -- if
- end -- while
- turtle.select(14)
- turtle.dig()
- turtle.select(1)
- turnLeft(1)
- print("Inventory cleared!")
- end -- if
- end -- if
- end -- function
- function checkFuel()
- if turtle.getFuelLevel() < 10 then
- turtle.select(15)
- print("Out of Fuel! Try to get Fuel...")
- print("Fuel Level:" .. turtle.getFuelLevel())
- turtle.refuel(64)
- turtle.select(1)
- for i2=1, 13, 1 do
- turtle.select(i2)
- if turtle.refuel(0) then
- turtle.refuel(64)
- print("Fuel Level:" .. turtle.getFuelLevel())
- end -- if
- end -- for
- end -- if
- end -- function
- function checkLight()
- if torch == 5 then
- turnRight(1)
- digUp()
- goUp()
- turtle.select(16)
- goForward()
- if not turtle.detect() then
- turtle.select(1)
- turtle.place()
- turtle.select(16)
- end -- if
- turnLeft(2)
- dig()
- goForward()
- turnRight(2)
- turtle.place()
- turnLeft(1)
- digDown()
- goDown()
- torch = 0
- end -- if
- end -- function
- function checkUnderground()
- if not turtle.detectDown() then
- turtle.select(1)
- turtle.placeDown()
- end
- end
- print("Put in slot 14 an Ender chest in slot 15 fuel and in slot 16 torches!")
- print("------------------------")
- print("Mining lenght: ")
- local lenght = read()
- startMining(lenght)
Add Comment
Please, Sign In to add comment