Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function main()
- for q = 1,150 do
- dig()
- turtle.digDown()
- digUp()
- turtle.down()
- checkBlocks('down')
- unmove()
- turtle.turnLeft()
- checkBlocks('front')
- unmove()
- turtle.turnRight()
- turtle.turnRight()
- checkBlocks('front')
- unmove()
- turtle.up()
- checkBlocks('front')
- unmove()
- turtle.up()
- checkBlocks('front')
- unmove()
- turtle.turnLeft()
- checkBlocks('down')
- unmove()
- turtle.turnLeft()
- checkBlocks('up')
- unmove()
- turtle.down()
- checkBlocks('front')
- unmove()
- turtle.turnRight()
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- for w = 1,150 do
- turtle.forward()
- end
- end
- moves = {}
- function checkBlocks(side)
- key, dataDown = turtle.inspectDown()
- key, dataUp = turtle.inspectUp()
- key, data = turtle.inspect()
- blocks = {'minecraft:gold_ore', 'minecraft:iron_ore', 'minecraft:coal_ore', 'minecraft:lapis_ore', 'minecraft:diamond_ore', 'minecraft:redstone_ore', 'minecraft:emerald_ore', 'mekanism:copper_ore', 'mekanism:tin_ore', 'mekanism:osmium_ore', 'mekanism:uranium_ore', 'mekanism:lead_ore', 'powah:uraninite_ore_poor', 'powah:uraninite_ore', 'powah:uraninite_ore_dense', 'immersiveengineering:ore_copper', 'immersiveengineering:ore_aluminum', 'immersiveengineering:ore_lead', 'immersiveengineering:ore_silver', 'immersiveengineering:ore_nickel'}
- if side == 'down' then
- for i = 1,#blocks do
- if dataDown.name == blocks[i] then
- turtle.digDown()
- turtle.down()
- addMove('down')
- checkBlocks('down')
- end
- end
- elseif side == 'front' then
- for i = 1,#blocks do
- if data.name == blocks[i] then
- dig()
- turtle.forward()
- addMove('forward')
- checkBlocks('front')
- end
- end
- elseif side == 'up' then
- for i = 1,#blocks do
- if dataUp.name == blocks[i] then
- digUp()
- turtle.up()
- addMove('up')
- checkBlocks('up')
- end
- end
- end
- end
- function addMove(side)
- table.insert(moves, side)
- end
- function unmove()
- if #moves > 0 then
- for e = 1,#moves do
- if moves[1] == 'down' then
- turtle.up()
- elseif moves[1] == 'up' then
- turtle.down()
- elseif moves[1] == 'forward' then
- turtle.back()
- elseif moves[1] == 'left' then
- turtle.turnRight()
- elseif moves[1] == 'right' then
- turtle.turnLeft()
- end
- table.remove(moves)
- end
- else
- return
- end
- end
- function digUp()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(.5)
- end
- end
- function dig()
- while turtle.detect() do
- turtle.dig()
- sleep(.5)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement