Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local slotCount = 16
- local width = 25
- local length = 25
- local height = 3
- if (arg[1] ~= nil) then
- width = arg[1]
- length = arg[1]
- end
- local trash = {
- "minecraft:cobblestone", "minecraft:stone", "minecraft:andesite",
- "minecraft:diorite", "minecraft:clay_ball", "minecraft:sand",
- "minecraft:sandstone", "minecraft:limestone", "minecraft:dirt",
- "quark:limestone", "minecraft:flint", "rustic:slate", "chisel:limestone2", "chisel:limestone", "minecraft:gravel"
- }
- function checkFuel()
- print('Checking fuel...')
- local refueled = false
- if (turtle.getFuelLevel() < 3000) then
- for slot = 1, slotCount, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- if (item.name == "minecraft:coal" or item.name ==
- "minecraft:coal_block") then
- print('Attemping to refuel with %d', item.name)
- turtle.select(slot)
- local result = turtle.refuel()
- refueled = true
- print('Turtle refueled...')
- break
- end
- end
- end
- if (refueled == false) then
- print('Did not find coal in inventory.. going to power down soon D:')
- end
- return false
- end
- end
- function digColumn()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- end
- function purgeTrash()
- for slot = 1, slotCount, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- for key, value in pairs(trash) do
- if (value == item.name) then
- print("found trash:", item.name)
- print('trash in slot:', slot)
- turtle.select(slot)
- turtle.drop()
- break
- end
- end
- end
- end
- end
- function turnAround(dir)
- print("turning around...")
- if dir == "right" then turtle.turnRight() end
- if dir == "left" then turtle.turnLeft() end
- digColumn()
- if dir == "right" then turtle.turnRight() end
- if dir == "left" then turtle.turnLeft() end
- end
- function digBlock()
- while turtle.detect() == false do turtle.forward() end
- for row = 1, width, 1 do
- for col = 1, length, 1 do
- digColumn()
- checkFuel()
- print("col:", col)
- print("length:", length)
- if (col == length) then
- print('i should probably turn around')
- end
- end
- purgeTrash()
- if row % 2 == 1 then turnAround("right") end
- if row % 2 == 0 then turnAround("left") end
- end
- end
- digBlock()
Advertisement
Add Comment
Please, Sign In to add comment