Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bedrockFound = false
- local function goUp()
- local upFound = false
- while not upFound do
- if not turtle.moveUp() then
- upFound = true
- end
- end
- end
- local function checkInventorySpace()
- local isEmptySlot = false
- for i = 1, 16 do
- if turtle.getItemCount(i) <= 0 then
- isEmptySlot = true
- --break() TurtleOS 1.5 doesnt have?
- end
- end
- return isEmptySlot
- end
- local function emptyInventory()
- for i = 2, 16 do --empty every slot except first one (for fuel)
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(1)
- end
- while not bedrockFound do
- turtle.select(1) --select slot 1 for fuel
- if turtle.getFuelLevel() <= 5 then
- turtle.refuel()
- end
- if checkInventorySpace() then --if has space in inventory do dig
- if turtle.detectDown() then
- local brokeBlock = turtle.digDown()
- if not brokeBlock then --block is unbreakable
- bedrockFound = true
- end
- turtle.moveDown()
- end
- else
- goUp()
- emptyInventory()
- end
- end
- if bedrockFound then
- goUp()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement