Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tunnelLength = 32
- gapBetweenTunnels = 2
- freakOutOres = {
- "minecraft:diamond_ore",
- "immersiveengineering:ore_silver",
- }
- bridgeBlocks = {
- "minecraft:granite",
- "minecraft:cobblestone",
- }
- UP = 1
- DOWN = 2
- function freakOut()
- print("FREAKING THE FUCK OUT!!!!")
- read()
- end
- function hasItem(name)
- for i = 1, 16 do
- local block = turtle.getItemDetail(i)
- if block ~= nil then
- if block.name == name then
- return true, i, block
- end
- end
- end
- return false, nil, nil
- end
- function isInFront(name)
- local success, block = turtle.inspect()
- if success == true then
- if block.name == name then
- return true
- end
- end
- return false
- end
- function dig(dir)
- local success, block = turtle.inspect()
- if success == true then
- for _, v in pairs(freakOutOres) do
- if v == block.name then
- freakOut()
- end
- end
- end
- dir = dir or 0
- if dir == UP then
- turtle.digUp()
- elseif dir == DOWN then
- turtle.digDown()
- else
- turtle.dig()
- end
- end
- function tryPlaceBridgeBlock()
- for _, v in pairs(bridgeBlocks) do
- local success, index, block = hasItem(v)
- if success == true then
- turtle.select(index)
- turtle.placeDown()
- break
- end
- end
- end
- function tryPlaceBridgeBlockOnFloor()
- local success, block = turtle.inspectDown()
- if success == false then
- tryPlaceBridgeBlock()
- elseif success == true then
- if block.name == "minecraft:lava" or block.name == "minecraft:water" then
- tryPlaceBridgeBlock()
- end
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- if isInFront("minecraft:chest") == false then
- error("No chest found!")
- end
- turtle.turnRight()
- turtle.turnRight()
- print("Chest found, lets get mining!")
- offsetFromChest = 0
- while true do
- turtle.turnLeft()
- --Forward Action Tunnel 1 1x2
- for i = 0, tunnelLength do
- dig()
- turtle.forward()
- dig(UP)
- end
- --Back to original spot
- for i = 0, tunnelLength do
- tryPlaceBridgeBlockOnFloor()
- turtle.back()
- end
- --Face the direction of action tunnel 2
- turtle.turnRight()
- turtle.turnRight()
- --Forward Action Tunnel 2 1x2
- for i = 0, tunnelLength do
- dig()
- turtle.forward()
- dig(UP)
- end
- --Back to original - 1 so that it isn't in the center
- for i = 0, tunnelLength - 1 do
- tryPlaceBridgeBlockOnFloor()
- turtle.back()
- end
- turtle.turnLeft()
- --Refuel on any coal it has
- local success, index, block = hasItem("minecraft:coal")
- if success == true then
- turtle.select(index)
- turtle.refuel(block.count)
- end
- --excavate 3 x 3 space in center
- for i = 0, gapBetweenTunnels do
- dig()
- turtle.forward()
- local success, block = turtle.inspectDown()
- dig(UP)
- turtle.up()
- dig(UP)
- turtle.turnLeft()
- dig()
- turtle.forward()
- dig(UP)
- dig(DOWN)
- dig()
- turtle.forward()
- dig(UP)
- dig(DOWN)
- turtle.back()
- turtle.back()
- turtle.turnRight()
- turtle.down()
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- --Keeps dumping away cobblestone!
- local success, index, block = hasItem("minecraft:cobblestone")
- while success do
- turtle.select(index)
- turtle.drop()
- success, index, block = hasItem("minecraft:cobblestone")
- end
- --Facing towards chest runs forward
- offsetFromChest = offsetFromChest + gapBetweenTunnels + 1
- for i = 1, offsetFromChest do
- turtle.forward()
- end
- --Drops all items in chest
- for i = 1, 16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = 1, offsetFromChest do
- turtle.forward()
- end
- end
Add Comment
Please, Sign In to add comment