Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = 0
- y = 0
- z = 0
- checks = 0
- chestsDropped = 0
- mined = 0
- function getCount()
- count = 0
- for i = 3,15,1 do
- count = count + turtle.getItemCount(i)
- end
- return count
- end
- function deposit()
- turtle.select(1)
- turtle.turnLeft()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- turtle.dig()
- turtle.down()
- turtle.place()
- chestsDropped = chestsDropped + 1
- for i = 3,15,1 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnRight()
- end
- function checkWanted()
- success, data = turtle.inspect()
- if data.name == "minecraft:diamond_ore" or data.name == "minecraft:redstone_ore" or data.name == "minecraft:iron_ore" or data.name == "minecraft:coal_ore" or data.name == "minecraft:gold_ore" or data.name == "minecraft:lapis_ore" or data.name == "projectred-exploration:ore" or data.name == "thermalfoundation:ore" then
- print("I found ", data.name, "!")
- return true
- end
- end
- function checkWantedUp()
- success, data = turtle.inspectUp()
- if data.name == "minecraft:diamond_ore" or data.name == "minecraft:redstone_ore" or data.name == "minecraft:iron_ore" or data.name == "minecraft:coal_ore" or data.name == "minecraft:gold_ore" or data.name == "minecraft:lapis_ore" or data.name == "projectred-exploration:ore" or data.name == "thermalfoundation:ore" then
- print("I found ", data.name, "!")
- return true
- end
- end
- function checkWantedDown()
- success, data = turtle.inspectDown()
- if data.name == "minecraft:diamond_ore" or data.name == "minecraft:redstone_ore" or data.name == "minecraft:iron_ore" or data.name == "minecraft:coal_ore" or data.name == "minecraft:gold_ore" or data.name == "minecraft:lapis_ore" or data.name == "projectred-exploration:ore" or data.name == "thermalfoundation:ore" then
- print("I found ", data.name, "!")
- return true
- end
- end
- function checkLavaCheck()
- success, data = turtle.inspect()
- if data.name == "minecraft:lava" then
- return true
- end
- end
- function checkLavaCheckUp()
- success, data = turtle.inspectUp()
- if data.name == "minecraft:lava" then
- if y == h - 1 then
- return true
- end
- end
- end
- function checkLavaCheckDown()
- success, data = turtle.inspectDown()
- if data.name == "minecraft:lava" then
- if y == 0 then
- return true
- end
- end
- end
- function check()
- print("I'm gonna check for some ore and lava!")
- print("Checking in front of me!")
- if checkWanted() then
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- checks = checks + 1
- check()
- turtle.back()
- checks = checks - 1
- end
- if checkLavaCheck() then
- print("I found some in front of me!")
- turtle.select(16)
- print(turtle.place())
- print(turtle.refuel())
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- end
- print("Checking to my left!")
- turtle.turnLeft()
- if checkWanted() then
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- checks = checks + 1
- check()
- turtle.back()
- checks = checks - 1
- end
- if checkLavaCheck() then
- print("I found some to my left!")
- turtle.select(16)
- print(turtle.place())
- print(turtle.refuel())
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- if checks == 0 then
- turtle.select(2)
- turtle.place()
- end
- end
- print("Checking to my right!")
- turtle.turnRight()
- turtle.turnRight()
- if checkWanted() then
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- checks = checks + 1
- check()
- turtle.back()
- checks = checks - 1
- end
- if checkLavaCheck() then
- print("I found some to my right!")
- turtle.select(16)
- print(turtle.place())
- print(turtle.refuel())
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- if checks == 0 then
- turtle.select(2)
- turtle.place()
- end
- end
- turtle.turnLeft()
- print("Checking above me!")
- if checkWantedUp() then
- turtle.digUp()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.up()
- checks = checks + 1
- check()
- turtle.down()
- checks = checks - 1
- end
- if checkLavaCheckUp() then
- print("I found some above me!")
- turtle.select(16)
- turtle.placeUp()
- turtle.refuel()
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- if checks == 0 then
- turtle.select(2)
- turtle.placeUp()
- end
- end
- print("Checking below me!")
- if checkWantedDown() then
- turtle.digDown()
- turtle.down()
- checks = checks + 1
- check()
- turtle.up()
- checks = checks - 1
- end
- if checkLavaCheckDown() then
- print("I found some below me!")
- turtle.select(16)
- turtle.placeDown()
- turtle.refuel()
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- if checks == 0 then
- turtle.select(2)
- turtle.placeDown()
- end
- end
- end
- function mine()
- turtle.select(15)
- turtle.refuel()
- turtle.select(1)
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- print("I have ", getCount(), " items.")
- if turtle.detect() == true then
- turtle.dig()
- end
- for a = 1, h-1, 1 do
- if turtle.detectUp() then
- turtle.digUp()
- end
- if turtle.up() then
- y = y + 1
- end
- if turtle.detect() == true then
- turtle.dig()
- end
- end
- check()
- while y > 0 do
- if turtle.down() then
- y = y - 1
- end
- check()
- end
- if turtle.detectDown() == false then
- turtle.select(2)
- turtle.placeDown()
- end
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- z = z + 1
- if getCount() > 320 then
- deposit()
- end
- if z + h * 4 > turtle.getFuelLevel() then
- while z > 0 do
- turtle.back()
- z = z - 1
- print("Low on fuel!")
- print("Fuel level = ", turtle.getFuelLevel())
- end
- print("Please insert more fuel in slot 15!")
- read()
- turtle.select(15)
- turtle.refuel()
- turtle.select(1)
- end
- if z > 0 then
- print("I'm ", z,"/", l, " of the way done.")
- end
- end
- function sideMine()
- turtle.select(15)
- turtle.refuel()
- turtle.select(1)
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
- print("I have ", getCount(), " items.")
- if turtle.detect() == true then
- turtle.dig()
- end
- for a = 1, h-1, 1 do
- if turtle.detectUp() then
- turtle.digUp()
- end
- if turtle.up() then
- y = y + 1
- end
- if turtle.detect() == true then
- turtle.dig()
- end
- end
- check()
- while y > 0 do
- if turtle.down() then
- y = y - 1
- end
- check()
- end
- if turtle.detectDown() == false then
- turtle.select(2)
- turtle.placeDown()
- end
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- x = x + 1
- if getCount() > 320 then
- deposit()
- end
- end
- print("+-------------------------------------+")
- print("| Branch Mine |")
- print("+-------------------------------------+")
- print("| Slot 15: Fuel |")
- print("| Slot 16: Empty Bucket |")
- print("| Slot 1: Chests |")
- print("| Slot 2: Blocks |")
- print("+-------------------------------------+")
- print("| Place turtle at start of mine. |")
- print("| Insert fuel. Specify height and |")
- print("| length. Press enter to start. |")
- print("+-------------------------------------+")
- read()
- print("+-------------------------------------+")
- print("| Mine length = ? |")
- print("+-------------------------------------+")
- l = tonumber(read())
- print("+-------------------------------------+")
- print("| Mine height = ? (>=2) |")
- print("+-------------------------------------+")
- h = tonumber(read())
- print("+-------------------------------------+")
- print("| Amount of shafts = ? |")
- print("+-------------------------------------+")
- m = tonumber(read())
- while z < l do
- mine()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- while z > 0 do
- turtle.dig()
- turtle.forward()
- z = z - 1
- end
- turtle.turnLeft()
- mined = mined + 1
- while mined < m do
- sideMine()
- sideMine()
- sideMine()
- turtle.turnLeft()
- while z < l do
- mine()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- while z > 0 do
- turtle.dig()
- turtle.forward()
- z = z - 1
- end
- turtle.turnLeft()
- mined = mined + 1
- end
- turtle.turnLeft()
- turtle.turnLeft()
- while x > 0 do
- turtle.dig()
- turtle.forward()
- x = x - 1
- end
- turtle.turnRight()
- print("I put down ", chestsDropped, " chests for you.")
- print("My fuel level is at ", turtle.getFuelLevel(), ".")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement