Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkFuel()
- currentFuel = turtle.getFuelLevel()
- currentSlot = turtle.getSelectedSlot()
- if turtle.getFuelLevel() < 1 then
- for slot = 1,16 do
- if turtle.refuel() then
- return true, "Fueled"
- elseif slot == 16 then
- return false, "No fuel left"
- end
- end
- else
- print("there is still "..currentFuel.." Fuel left")
- return false
- end
- end
- function isValuable()
- local isValuable = true
- succes, data = turtle.inspect()
- if data["name"] == "minecraft:grass" or data.name == "minecraft:stone" or data.name == "minecraft:cobblestone" or data.name == "minecraft:dirt" or turtle.detect() == false then
- isValuable = false
- else
- isValuable = true
- end
- return isValuable
- end
- function checkWalls()
- for checking = 1,4 do
- if isValuable() == true then
- turtle.dig()
- end
- turtle.turnRight()
- end
- end
- function printinv()
- print("Printing the inventory: ")
- currentSlot = turtle.getSelectedSlot()
- for slot = 1,16 do
- turtle.select(slot)
- data = turtle.getItemDetail()
- if data then
- print("slot "..slot.." has "..data.count.." "..data.name)
- else
- print("slot "..slot.." has no items")
- end
- end
- turtle.select(currentSlot)
- end
- depth = 0
- checkFuel()
- turtle.digDown()
- while turtle.detectDown() == false do
- if turtle.down() then
- depth = depth + 1
- print("I am "..depth.." levels deep")
- end
- checkFuel()
- checkWalls()
- succes, data = turtle.inspect()
- if not turtle.digDown() and data.name == "minecraft:bedrock" then
- break
- end
- end
- checkFuel()
- for surface = 1,depth do
- turtle.up()
- if surface == depth then
- turtle.placeDown()
- end
- end
- printinv()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement