Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- depth = 0
- descending = true
- function fuel()
- if turtle.getFuelLevel() <= 10 then
- turtle.select(16)
- turtle.refuel()
- end
- end
- function isValuable()
- local junkTable = {"minecraft:stone", "minecraft:dirt", "minecraft:gravel", "minecraft:sand", "minecraft:torch"}
- local valuable = true
- local isBlock, blockData = turtle.inspect()
- if isBlock == true then
- print("There's something here. Block data:")
- print(blockData.name)
- print(blockData.metadata)
- for k, v in ipairs(junkTable) do
- if blockData.name == v then
- print("This is junk.")
- valuable = false
- break
- end
- end
- else
- print("There isn't anything here.")
- valuable = false
- end
- if valuable then
- print("There's something valuable here!")
- return true
- else
- print("Nothing interesting here. Moving on")
- return false
- end
- end
- function checkSides()
- for i = 0, 3, 1 do
- if isValuable() then
- turtle.dig()
- end
- turtle.turnRight()
- end
- end
- function isBottomEmpty()
- local isBlock, blockData = turtle.inspect()
- if isBlock then
- return true
- else
- return false
- end
- end
- function isBottomBedrock()
- local isBlock, blockData = turtle.inspectDown()
- if isBlock then
- if blockData.name == "minecraft:bedrock" then
- print("We've hit bedrock!")
- return true
- else
- return false
- end
- else
- return false
- end
- end
- print("Let's go!")
- while descending do
- fuel()
- checkSides()
- if isBottomBedrock() then
- descending = false
- break
- end
- turtle.digDown()
- turtle.down()
- depth = depth + 1
- end
- print("Let's go back up...")
- while depth ~= 0 do
- fuel()
- if turtle.up() then
- depth = depth - 1
- else
- print("Obstruction detected...")
- turtle.digUp()
- end
- end
- print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement