Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local blacklist = {"ComputerCraft:CC-Peripheral","ComputerCraft:CC-Computer","ComputerCraft:CC-Turtle","ComputerCraft:CC-TurtleAdvanced","chisel:limestone","Magneticraft:limestone","BiomesOPlenty:limestone","chisel:granite","chisel:marble","chisel:diorite","chisel:andesite","minecraft:tallgrass","minecraft:sand","minecraft:diorite","minecraft:andesite","minecraft:granite","minecraft:grass", "minecraft:bedrock","minecraft:flowing_lava","minecraft:flowing_water","minecraft:lava","minecraft:water","chisel:marble","minecraft:stone","minecraft:cobblestone","minecraft:dirt","minecraft:gravel"}
- function check(thing)
- if thing ~= nil then
- for i, v in pairs(blacklist) do
- if thing.name == v then
- return false
- end
- end
- return true
- end
- return false
- end
- function turtleRefillThing()
- if turtle.getFuelLevel() ~= "unlimited" then
- if turtle.getFuelLevel() < (turtle.getFuelLimit() / 5) then
- local nums = {}
- for p = 1, 16 do
- local o = turtle.getItemDetail(p)
- if o ~= nil then
- if o.name == "minecraft:coal" or o.name == "minecraft:planks" or o.name == "minecraft:fence" then
- table.insert(nums,p)
- end
- end
- end
- for o, p in pairs(nums) do
- turtle.select(p)
- local itemName = (turtle.getItemDetail(p))
- if itemName == nil then
- itemName = {}
- itemName["name"] = "EMPTY"
- end
- if check(itemName) == false then
- turtle.select(p)
- turtle.drop()
- turtle.dropDown()
- turtle.dropUp()
- end
- while turtle.getFuelLevel() < turtle.getFuelLimit() / 5 and turtle.getItemCount(turtle.getSelectedSlot()) > 0 and turtle.getItemDetail(turtle.getSelectedSlot()) ~= nil do
- turtle.refuel()
- end
- if turtle.getFuelLevel() >= turtle.getFuelLimit() / 5 then
- break
- end
- end
- else
- turtle.refuel()
- end
- end
- end
- function mineOre()
- local work, inspect = turtle.inspect()
- local worku, inspectu = turtle.inspectUp()
- local workd, inspectd = turtle.inspectDown()
- if work then
- if check(inspect) then
- local swood = turtle.dig()
- if not swood then return end
- repeat until turtle.forward()
- turtle.turnLeft()
- for i = 1, 3 do
- local wo, ex = turtle.inspect()
- local wo2, ex2 = turtle.inspectDown()
- local wo3, ex3 = turtle.inspectUp()
- if wo and check(ex) and swood then
- mineOre()
- end
- if wo2 and check(ex2) then
- local meow = turtle.digDown()
- if meow then
- repeat until turtle.down()
- mineOre()
- repeat until turtle.up()
- end
- end
- if wo3 and check(ex3) then
- local meow = turtle.digUp()
- if meow then
- repeat until turtle.up()
- mineOre()
- repeat until turtle.down()
- end
- end
- if i < 3 then
- turtle.turnRight()
- end
- end
- turtle.turnLeft()
- repeat until turtle.back()
- end
- end
- if worku then
- if check(inspectu) then
- turtle.digUp()
- repeat until turtle.up()
- mineOre()
- repeat until turtle.down()
- end
- end
- if workd then
- if check(inspectd) then
- turtle.digDown()
- repeat until turtle.down()
- mineOre()
- repeat until turtle.up()
- end
- end
- end
- turtleRefillThing()
- turtle.select(1)
- n = 0
- built = false
- done = false
- while done == false do
- turtle.digDown()
- if (n == 0) then
- turtleRefillThing()
- repeat until turtle.down()
- if (turtle.detectDown()) then
- turtle.digDown()
- end
- n = n + 1
- end
- for i = 1,4 do
- mineOre()
- turtle.turnRight()
- end
- if turtle.detectDown() then
- for i = 1,n do
- turtleRefillThing()
- repeat
- if turtle.detectUp() then
- turtle.digUp()
- end
- until turtle.up()
- end
- turtle.select(1)
- turtle.placeDown()
- done = true
- else
- n = n + 1
- turtleRefillThing()
- repeat until turtle.down()
- end
- end
Add Comment
Please, Sign In to add comment