Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get BaBEfuc2 miner
- yLevel = 0
- i = 0
- block = "false"
- data = "false"
- height = 55
- function bottom() --bottom out to find y level
- while true do
- block,data = turtle.digDown()
- if data == "Unbreakable block detected" then
- break
- end
- while turtle.dig() do
- end
- turtle.down()
- end
- end
- -----------------------
- function empty() -- place enderchest and empty. this function is run after clear()
- while turtle.dig() do
- sleep(.2)
- end
- turtle.select(16)
- turtle.place()
- for i = 1, 14 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(16)
- turtle.dig()
- turtle.select(1)
- turtle.forward()
- while turtle.dig() do
- sleep(.2)
- end
- turtle.forward()
- end
- -----------------------
- function clear() -- check area for bedrock
- for i = 1, 5 do
- while turtle.dig() do
- sleep(.2)
- end
- turtle.dig()
- while turtle.digUp() do
- sleep(.2)
- end
- turtle.up()
- end
- end
- -----------------------
- function turtleRefuel()
- if turtle.getFuelLevel() < 5000 then
- for i=1,14 do
- turtle.select(i)
- turtle.refuel()
- turtle.select(1)
- end
- end
- end
- -----------------------
- function lowFuel() -- checks for low fuel and waits if at top of loop
- if turtle.getFuelLevel() < 200 then
- local i = turtle.getItemCount(15)-1
- turtle.select(15)
- turtle.refuel(i)
- turtle.select(1)
- print("WARNING: Low Fuel")
- if yLevel > height then
- print("Waiting for fuel")
- os.pullEvent("turtle_inventory")
- end
- end
- end
- ---------------------
- function self()
- turtleRefuel()
- lowFuel()
- lowFuel()
- end
- --------------------
- function minerUp() -- bottom to top mining
- for i=0,height do
- while turtle.digUp() do
- sleep(.2)
- end
- while turtle.dig() do
- sleep(.2)
- end
- turtle.up()
- end
- end
- -------------------
- function inventory() -- check for fuel and enderchest
- print("fuel in slot 15")
- print("enderchest in slot 16")
- turtle.dig() --just in case it is placed before a restart
- while turtle.getItemCount(16) == 0 do
- os.pullEvent("turtle_inventory")
- end
- while turtle.getItemDetail(16).name ~= "EnderStorage:enderChest" do
- print("ender chest in slot 16")
- os.pullEvent("turtle_inventory")
- end
- end
- --------------------
- -- Main function
- -- start with going to bedrock
- inventory()
- bottom()
- print("Reached Bedrock")
- yLevel=0
- -- the turtle miner is now ready
- while true do
- clear()-- making room for chest
- yLevel=5
- self()-- fuel check
- empty()-- place chest, empty, get chest, move into postion
- print("Mining Up")
- bottom()
- minerUp()
- clear()-- making room for chest
- yLevel=height+5
- self()-- fuel check
- empty()-- place chest, empty, get chest, move into postion
- print("Mining Down")
- bottom() -- minerUp, just backwards
- end
Advertisement
Add Comment
Please, Sign In to add comment