Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetCoal()
- local count = 16
- repeat
- local currentSlot = turtle.getSelectedSlot()
- local data = turtle.getItemDetail(currentSlot)
- if data.name == "minecraft:coal" then
- return true
- else
- turtle.select((currentSlot%16)+1)
- count = count - 1
- end
- until(count == 0)
- print("Can't find coal")
- return false
- end
- function RefuelCoal()
- if turtle.getFuelLevel() == 0 then
- local result = GetCoal()
- if result then
- print("Coal Found! Refueling")
- turtle.refuel(1)
- else
- print("No Coal Found!")
- end
- return result
- else
- return true
- end
- end
- amount = arg[1] or 50
- print("Mining for " .. amount .. " blocks")
- for i=1,amount,1 do
- result = RefuelCoal()
- if result then
- turtle.dig()
- turtle.digUp()
- turtle.forward()
- else
- error("OUT OF FUEL")
- end
- end
Add Comment
Please, Sign In to add comment