Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tunnelLength = 100
- buffer = 2
- tunnels = 10
- placeTorches = true
- blocksBetweenTorches = 10
- autoRefuel = true
- startLeft = false
- trash = {
- dirt = true,
- cobblestone = true,
- stone = true,
- gravel = true,
- quartz = true,
- resource = true,
- nugget = true,
- redstone = true,
- iron_ore = true,
- flint = true
- }
- local function check()
- for i=2,15 do
- item = turtle.getItemDetail(i)
- if item ~= nil then
- print("Item: "..item.name)
- print(trash[item.name])
- colon = string.find(item.name, ":")
- if trash[string.sub(item.name, colon + 1)] ~= nil and item.count > 0 then
- print("That's trash, throw it out")
- turtle.select(i)
- turtle.dropDown()
- elseif item.name == "minecraft:coal" and autoRefuel then
- if turtle.getItemDetail(1).name == "minecraft:coal" then
- turtle.transferTo(1, item.count)
- end
- if turtle.getFuelLevel() < 50 then
- turtle.select(1)
- turtle.refuel()
- end
- elseif item.name == "minecraft:torch" then
- turtle.transferTo(16, turtle.getItemCount(i))
- end
- end
- end
- os.setComputerLabel("Fuel: "..turtle.getFuelLevel())
- turtle.select(1)
- end
- local function height()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- isBlock, block = turtle.inspect()
- if isBlock and block.name == "minecraft:gravel" then
- height()
- end
- end
- local function length()
- for i=1,tunnelLength do
- height()
- if (i % (blocksBetweenTorches + 1)) == 0 and placeTorches and turtle.getItemDetail(16) ~= nil and turtle.getItemDetail(16).name == "minecraft:torch" then
- turtle.select(16)
- turtle.placeDown()
- turtle.select(2)
- end
- if i % 15 == 0 then
- check()
- end
- turtle.forward()
- end
- end
- local function main()
- for k=1,tunnels do
- length()
- if startLeft then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- for k=1,buffer + 1 do
- height()
- turtle.forward()
- end
- if startLeft then
- turtle.turnLeft()
- startLeft = false
- else
- turtle.turnRight()
- startLeft = true
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement