Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refuel(min)
- if turtle.getFuelLevel() < min then
- turtle.select(1)
- while turtle.getFuelLevel() < min do
- turtle.refuel(1)
- end
- else
- return true
- end
- end
- function forward()
- if not turtle.forward() then
- turtle.attack()
- turtle.dig()
- forward()
- end
- end
- function upward()
- if not turtle.up() then
- turtle.digUp()
- upward()
- end
- end
- function downward()
- if not turtle.down() then
- turtle.digDown()
- downward()
- end
- end
- function inspectOre(s,d)
- if s then
- if d.name == "minecraft:iron_ore" or d.name == "minecraft:diamond_ore" or d.name == "minecraft:gold_ore" or d.name == "minecraft:coal_ore" or d.name == "minecraft:redstone_ore" then
- return true
- end
- end
- return false
- end
- function checkForOres()
- if inspectOre(turtle.inspect()) then
- forward()
- checkForOres()
- turtle.back()
- end
- turtle.turnRight()
- if inspectOre(turtle.inspect()) then
- forward()
- checkForOres()
- turtle.back()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- if inspectOre(turtle.inspect()) then
- forward()
- checkForOres()
- turtle.back()
- end
- turtle.turnRight()
- if inspectOre(turtle.inspectUp()) then
- upward()
- checkForOres()
- turtle.down()
- end
- if inspectOre(turtle.inspectDown()) then
- downward()
- checkForOres()
- turtle.up()
- end
- end
- print("How many blocks do you want to mine")
- local amount = read()
- count = 1
- for i=1,amount do
- if refuel(count) then
- forward()
- checkForOres()
- count=count+1
- else
- print("not enough Fuel")
- break
- end
- end
- for j=1,count do
- turtle.back()
- end
- print("----------DONE-----------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement