Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local harvested = 0
- if fs.exists("amount") then
- local filer = fs.open("amount", "r")
- harvested = tonumber((filer.readAll() or "") or "0")
- filer.close()
- end
- harvested = harvested or 0
- local function resolveFuel()
- for i = 1, 16 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item and (item.name == "minecraft:lava_bucket" or item.name == "minecraft:charcoal") then
- turtle.refuel()
- end
- end
- return false
- end
- local function saveHarvested()
- local filew = fs.open("amount", "w")
- filew.write(tostring(harvested))
- filew.close()
- end
- local timer = 0
- os.sleep(1)
- resolveFuel()
- while true do
- if turtle.dig() then
- harvested = harvested + 1
- end
- if turtle.digDown() then
- harvested = harvested + 1
- end
- if timer>20 then
- print("Fuel: "..turtle.getFuelLevel())
- print("Cobblestone Broken: "..harvested)
- saveHarvested()
- timer = 0
- else
- timer = timer + 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement