Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sleeptime = 60 * 40 -- 35 minutes
- maxFarm = 2
- local pasteID = "http://pastebin.com/raw.php?i=mPkBiaLL"
- debug = true
- pasteContent = http.get(pasteID)
- Paste = pasteContent.readAll()
- pasteContent.close()
- function update()
- file = fs.open("startup","r")
- contents = file.readAll()
- file.close()
- if (Paste ~= contents) then
- print("Updating program...")
- shell.run("delete","startup")
- wFile = fs.open("startup","w")
- wFile.write(Paste)
- wFile.close()
- sleep(1)
- os.reboot()
- end
- end
- function checkFuel()
- if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 150 then
- for i = 1, 16 do
- turtle.select( i )
- turtle.refuel()
- end
- if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 150 then
- print("I need food.")
- sleep(15)
- os.reboot()
- end
- else
- print("My fuel level is well within boundary at "..turtle.getFuelLevel())
- end
- end
- function checkBlock()
- local success, data = turtle.inspectDown()
- if success then
- if (data.name == "minecraft:wheat") then
- print(data.name)
- print("Found some wheat")
- if (data.metadata == 7) then
- turtle.select(1)
- turtle.digDown()
- turtle.select(2)
- turtle.placeDown()
- else
- print("It ain't good yet!")
- end
- end
- else
- print(data.name)
- print("not wheat")
- turtle.select(2)
- local data = turtle.getItemDetail()
- if data then
- if (data.name == "minecraft:wheat_seeds") then
- turtle.placeDown()
- print("Placed some of them seeds")
- else
- print("I ain't got no seeds ya fool!")
- end
- else
- print("I ain't got no seeds ya fool!")
- end
- turtle.select(1)
- end
- end
- function doDaFarm()
- turtle.turnRight()
- turtle.forward()
- checkBlock()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- checkBlock()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- turtle.select(1)
- update()
- checkFuel()
- for i=0,maxFarm do
- turtle.forward()
- doDaFarm()
- i=i+1
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=0,maxFarm do
- turtle.forward()
- i=i+1
- end
- turtle.select(1)
- local data = turtle.getItemDetail()
- if data then
- if (data.name == "minecraft:wheat_seeds") then
- turtle.drop()
- else
- print("I ain't got no wheat.. or I'm broken.")
- end
- else
- print("I ain't got no wheat.. or I'm broken.")
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(1)
- if (debug == false) then
- sleep(sleeptime)
- else
- sleep(10)
- print("40 seconds remaining")
- sleep(10)
- print("30 seconds remaining")
- sleep(10)
- print("20 seconds remaining")
- sleep(10)
- print("10 seconds remaining")
- end
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement