Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pos = 0
- local fuel = "minecraft:lava_bucket"
- local fuelContainer = "enderstorage:ender_chest"
- local keep = {
- [fuel] = true,
- ["minecraft:ancient_debris"] = true,
- ["tconstruct:cobalt_ore"] = true,
- ["minecraft:cobblestone"] = true
- }
- local badFluid = "minecraft:lava"
- local dir = 1
- local length = 30
- local turtle = turtle -- This line is just becus i use VS code and its is complaning on all lines that containins "turtle" so i make this vriabel you can remove it or keep it do as you whant
- local function refuel()
- for i = 1, 16 do -- for each slot in the chest
- local item = turtle.getItemDetail(i, false)
- if item then -- if there is an item in this slot
- if string.format("%s", item.name) == fuelContainer then -- if the item is in the blacklist
- turtle.select(i)
- break;
- end
- end
- end
- turtle.placeUp()
- if(turtle.detectUp()) then
- local chest = peripheral.find("chest")
- local list = chest.list()
- for i = 1, chest.size() do -- for each slot in the chest
- local item = list[i]
- if item then -- if there is an item in this slot
- if not blacklist[string.format("%s:%s", item.name, item.metadata)] then -- if the item is NOT in the blacklist
- -- do something with the item.
- end
- end
- end
- else
- error("did not found the enderchest above shuting down")
- end
- end
- local function checkInv()
- for i = 1, 16 do -- for each slot in the chest
- local item = turtle.getItemDetail(i, false)
- if item then -- if there is an item in this slot
- if not keep[string.format("%s", item.name)] then -- if the item is in the blacklist
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- end
- local function select()
- for i = 1, 16 do -- for each slot in the chest
- local item = turtle.getItemDetail(i, false)
- if item then -- if there is an item in this slot
- if not keep[string.format("%s", item.name)] then -- if the item is NOT in the blacklist
- turtle.select(i)
- end
- end
- end
- end
- local function lava()
- local isBlock,block = turtle.inspectUp()
- if isBlock then
- if block.name == badFluid then
- turtle.up()
- isBlock,block = turtle.inspectUp()
- if isBlock then
- if block.name == badFluid then
- select()
- turtle.placeUp()
- end
- end
- turtle.down()
- end
- end
- isBlock,block = turtle.inspectDown()
- if isBlock then
- if block.name == badFluid then
- turtle.down()
- isBlock,block = turtle.inspectDown()
- if isBlock then
- if block.name == badFluid then
- select()
- turtle.placeDown()
- end
- end
- turtle.up()
- end
- end
- end
- local function loop()
- local ready = true
- lava()
- while ready do
- while turtle.detect() do
- turtle.dig()
- print("block in front")
- end
- while turtle.detectUp() do
- turtle.digUp()
- print("block on top")
- end
- while turtle.detectDown() do
- turtle.digDown()
- print("block on botem")
- end
- if not turtle.detect() then
- ready = false
- end
- end
- lava()
- turtle.forward()
- end
- while true do
- if(pos == length) then
- pos = -1
- end
- refuel()
- loop()
- if(pos == -1) then
- if(dir == 1) then
- turtle.turnRight()
- dir = 0
- loop()
- turtle.turnRight()
- else
- turtle.turnLeft()
- dir = 1
- loop()
- turtle.turnLeft()
- end
- checkInv()
- end
- pos = pos +1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement