Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- netherborer.lua
- -- gaat een 9 breed op 9 hoog tunnel graven, tot 256 blocks lang.
- -- zal iedere 8 blocks zijn inventory legen, door items in de blacklist te yeeten en de rest te storen in een chest
- -- Primen door:
- -- 32 chests in slot 1
- -- een flint and steel in slot 2
- -- een empty bucket in slot 2
- -- plaats 1 item van de whitelisted resources in de inventory
- -- kies jouw 9x9 vlak en maak een gat in de linkeronderhoek op ooghoogte
- -- plaats de borer hierin, voorkant gericht op de richting van de tunnel
- -- execute het script
- -- HELPERS
- function contains(list, x)
- for _, v in pairs(list) do
- if v == x then return true end
- end
- return false
- end
- function safeForward()
- succ = turtle.forward()
- while not succ do
- turtle.dig()
- succ = turtle.forward()
- end
- end
- function safeDig()
- local bool, block = turtle.inspect()
- if bool then
- if block.name == "minecraft:lava" then
- turtle.select(4)
- turtle.place()
- turtle.refuel()
- turtle.select(1)
- end
- turtle.dig()
- end
- end
- function safeDigDown()
- local bool, block = turtle.inspectDown()
- if bool then
- if block.name == "minecraft:lava" then
- turtle.select(4)
- turtle.placeDown()
- turtle.refuel()
- turtle.select(1)
- end
- turtle.digDown()
- end
- end
- function safeDigUp()
- local bool, block = turtle.inspectUp()
- if bool then
- if block.name == "minecraft:lava" then
- turtle.select(3)
- turtle.placeUp()
- turtle.refuel()
- turtle.select(1)
- end
- turtle.digUp()
- end
- end
- -- GLOBALS
- blacklist = {
- "minecraft:basalt",
- "minecraft:netherrack",
- "minecraft:blackstone"
- }
- whitelist = {
- "minecraft:magma_block",
- "minecraft:quartz",
- "minecraft:gold_nugget",
- "minecraft:ancient_debris"
- }
- -- DIGGER
- function digHorizontalSlice(sliceidx, onFloor)
- for i=2,9 do -- horizontal slice
- turtle.dig()
- safeForward()
- safeDigUp()
- safeDigDown()
- end
- end
- -- if torch is true, place a torch
- function goThreeUp()
- turtle.up()
- safeDigUp()
- turtle.up()
- safeDigUp()
- turtle.up()
- safeDigUp()
- turtle.turnRight()
- turtle.turnRight()
- end
- function goThreeDown()
- turtle.turnRight()
- turtle.turnRight()
- turtle.down()
- safeDigDown()
- turtle.down()
- safeDigDown()
- turtle.down()
- safeDigDown()
- end
- function digSlice(i)
- turtle.turnRight()
- safeDigUp()
- safeDigDown()
- digHorizontalSlice(i, true)
- goThreeUp()
- digHorizontalSlice(i, false)
- goThreeUp()
- digHorizontalSlice(i, false)
- turtle.turnLeft()
- turtle.dig()
- safeForward()
- turtle.turnLeft()
- safeDigUp()
- safeDigDown()
- digHorizontalSlice(false)
- goThreeDown()
- digHorizontalSlice(false)
- goThreeDown()
- digHorizontalSlice(false)
- end
- function digChunk()
- for i=1,4 do
- digSlice(i)
- dumpBlacklist()
- turtle.turnRight()
- turtle.dig()
- safeForward()
- safeDigUp()
- safeDigDown()
- end
- end
- -- INVENTORY
- function dumpBlacklist()
- turtle.select(2) -- fire
- turtle.placeDown()
- for i=7,16 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item ~= nil then
- if contains(blacklist, item.name) then -- trash
- turtle.dropDown(item.count)
- end
- end
- end
- turtle.select(1)
- end
- function clearInventory()
- turtle.back()
- turtle.select(1) -- chest
- chestsuccess = turtle.placeUp()
- turtle.select(2) -- fire
- turtle.placeDown()
- for i=4,16 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item ~= nil then
- if item.name == "minecraft:coal" and turtle.getFuelLevel() < 1000 then --refuel
- turtle.refuel(item.count-1)
- elseif contains(blacklist, item.name) then -- trash
- turtle.dropDown(item.count)
- elseif contains(whitelist, item.name) and chestsuccess and i < 7 then -- keep 1 in inventory
- turtle.dropUp(item.count - 1)
- elseif chestsuccess then
- turtle.dropUp(item.count) --store
- end
- end
- end
- turtle.select(1)
- safeForward()
- end
- -- MAIN
- for i=1,32 do
- digChunk()
- clearInventory()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement