Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function surface()
- while turtle.detect() do
- turtle.up()
- end
- end
- local function getBelowName()
- present,tile = turtle.inspectDown()
- if present then
- return tile.name
- end
- end
- local function getBelowNameRaw(name)
- name = name or getBelowName()
- return string.sub(name,string.find(name,":")+1,#name)
- end
- local function getItemSlotName(id)
- turtle.select(id)
- slot = turtle.getItemDetail()
- return slot.name
- end
- deniedblocks = {"minecraft:dirt","minecraft:cobblestone","minecraft:stone"}
- print("Starting...")
- while true do
- surface()
- turtle.forward()
- if turtle.detectDown() then
- blockbelow = getBelowName()
- else
- blockbelow = "minecraft:air"
- end
- while getBelowNameRaw(blockbelow) ~= "minecraft:bedrock" do
- if blockbelow == "minecraft:lava" or blockbelow == "minecraft:flowing_lava" then
- turtle.select(1)
- turtle.place()
- turtle.refuel()
- print("Refueled. Fuel level now " .. turtle.getFuelLevel())
- else
- turtle.digDown()
- end
- for i=1,16,1 do
- if turtle.getItemCount(i) > 0 then
- slotname = getItemSlotName(i)
- for j=1,#deniedblocks,1 do
- if slotname == deniedblocks[j] then
- print("Slot " .. i .. " has denied block (" .. slotname .. "). Ejecting...")
- turtle.dropUp()
- end
- end
- end
- end
- turtle.down()
- end
- print("Layer done!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement