Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ComputerCraft command:
- -- bg pastebin run UUGAiRx1
- -- SETTINGS -------------------------------------------
- local fuel = {'minecraft:lava_bucket', 'minecraft:coal', 'minecraft:blaze_rod', 'minecraft:stick', 'minecraft:oak_log', 'minecraft:oak_planks', 'minecraft:birch_log', 'minecraft:birch_planks', 'minecraft:birch_door', 'minecraft:oak_door', 'minecraft:charcoal', 'minecraft:bamboo_block'}
- -------------------------------------------------------
- local function has_value (tab, val)
- for index, value in ipairs(tab) do
- if value == val then
- return true
- end
- end
- return false
- end
- local slot = 1
- shell.run("label", "set", "miningturtle")
- while true do
- turtle.digUp()
- turtle.digDown()
- turtle.suck()
- turtle.suckUp()
- turtle.suckDown()
- local has_block, data = turtle.inspect()
- if has_block then
- if (data["name"] == "computercraft:turtle_advanced") then
- if not turtle.back() then
- turtle.turnRight()
- end
- else
- turtle.dig()
- turtle.forward()
- end
- else
- turtle.turnRight()
- local rightblk = turtle.detect()
- turtle.turnLeft()
- if (rightblk) or (not (turtle.back())) then
- turtle.turnRight()
- end
- end
- -- Infinity life code
- for slot=1,16 do
- local item = turtle.getItemDetail(slot)
- if not (item == nil) then
- if (not has_value(fuel, item["name"])) then
- turtle.select(slot)
- turtle.drop()
- end
- if turtle.getFuelLevel() < 10 then
- turtle.select(slot)
- turtle.refuel(1)
- end
- end
- end
- -- Debug
- shell.run("clear")
- print("--- Debug ---")
- print("Fuel: " .. tostring(turtle.getFuelLevel()) .. "/" .. tostring(turtle.getFuelLimit()))
- --
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement