Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- acceptableItems = {'minecraft:diamond','minecraft:coal','minecraft:iron_ore','minecraft:emerald','minecraft:gold_ore','draconicevolution:draconium_dust'}
- acceptableItemsLength = 6
- -- 1 breaks up, -1 breaks down
- function destroy (direction)
- if direction == 1 then
- turtle.digUp()
- turtle.up()
- elseif direction == -1 then
- turtle.digDown()
- turtle.down()
- else
- error('invalid direction')
- end
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- -- if coal slot (1) has more than one coal, use
- function refuel ()
- if turtle.getItemCount(1) > 1 then
- turtle.select(1)
- turtle.refuel(turtle.getItemCount()-1)
- end
- end
- -- remove all items not in list
- function purge ()
- for i=2,16 do
- keep = false
- for j=1,acceptableItemsLength do
- if turtle.getItemDetail(i).name == acceptableItems[j] then
- keep = true
- end
- end
- if not keep then
- turtle.select(i)
- turtle.drop(i)
- end
- end
- end
- -- returns true if every slot is completely full
- function turtleInvFull ()
- fullCount = 0; -- # of slots full
- for i=2,16 do
- if turtle.getItemSpace(i) == 0 then
- fullCount = fullCount + 1;
- end
- end
- return fullCount == 15;
- end
- while (turtle.getFuelLevel() > 0) and not turtleInvFull() do
- -- mining down
- repeat
- success, data = turtle.inspectDown()
- destroy(-1)
- refuel()
- purge()
- until data.name == 'minecraft:bedrock'
- -- moves to new spot to mine up
- for i=1,3 do
- turtle.dig()
- turtle.forward()
- end
- -- end if turtle inv completely full
- if turtleInvFull() then
- break
- end
- -- mining up
- for i=2,70 do
- destroy(1)
- refuel()
- purge()
- end
- -- moves to new spot to mine down
- for i=1,3 do
- turtle.forward()
- turtle.dig()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement