Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x= 12
- z= 12
- -- Settings --
- -- x = laenge
- -- z = breite (MUSS EINE GERADE ZAHL SEIN)
- -- Um die Änderung zu bestätigen muss die
- -- Datei "farmfirststart" gelöscht werden
- -- vor dem nächsten start des Programms
- xid=os.getComputerID()
- os.setComputerLabel("Wheat-Farmer#"..xid)
- function farm()
- shell.run("clear")
- print("Farm Programm by M3veronMast3r")
- print("------------------------------")
- print(" !!!-WORK IN PROGRESS-!!!")
- print("Sent all Fails to +491748274510")
- end
- -- functions --
- function forward()
- while not turtle.forward() do
- sleep(1)
- end
- end
- function back()
- while not turtle.back() do
- sleep(1)
- end
- end
- function reboot()
- fields=x*z
- if fields > 192 then
- if field > 320 then
- if fields > 448 then
- if fields > 576 then
- o=5
- else
- o=7
- end
- else
- o=9
- end
- else
- o=11
- end
- else
- o=13
- end
- if fields > 704 then
- shell.run("clear")
- print("Fields over 704 Blocks are not Supported.")
- print("The Turtle has only 16 Slots and it needs")
- print("at least the first 4 to operate this farm.")
- print("")
- print("Means Slot 5 to 15 could be used to collect")
- print("11 Slots * 64 is 704")
- print("")
- print("You are trying to create a Field of "..fields.." Blocks.")
- print("")
- print("edit the wheat config and make the field smaller")
- print("")
- print("Good Bye")
- return
- end
- while turtle.getItemCount(16) < 1 do
- shell.run("clear")
- print("Need Chest for detecting DropOff")
- print("in Slot 16. It must be the same")
- print("Chest Type")
- sleep(1)
- end
- shell.run("clear")
- print("starting Farm Programm..")
- turtle.select(16)
- turtle.turnLeft()
- if turtle.compare() then
- turtle.turnRight()
- else
- while not turtle.compare() do
- while not turtle.detect() do
- forward()
- end
- if turtle.compare() then
- else
- turtle.turnRight()
- end
- end
- turtle.turnRight()
- farm()
- end
- end
- function check()
- if turtle.getItemCount(e) < 1 then
- while turtle.getItemCount(e) < 1 do
- e=e+1
- if e > 4 then
- e=2
- turtle.select(e)
- return
- end
- end
- end
- turtle.select(e)
- end
- function sort()
- ot=o-1
- for h=5,ot do
- if turtle.getItemCount(15) > 1 then
- while turtle.getItemCount(o) > 1 do
- o=o-1
- if o < 7 then
- reboot()
- turtle.turnLeft()
- drop()
- turtle.turnRight()
- sort()
- drop()
- os.reboot()
- end
- end
- end
- if turtle.getItemCount(h) > 1 then
- if turtle.getItemCount(e) < 32 then
- turtle.select(h)
- harvested=turtle.getItemCount(h)
- if turtle.compareTo(1) then
- for j=2,4 do
- SeedSlot=turtle.getItemCount(j)
- if SeedSlot < 64 then
- SeedsNeeded= 64-SeedSlot
- if SeedsNeeded > harvested then
- turtle.transferTo(j,harvested)
- else
- turtle.transferTo(j,SeedsNeeded)
- end
- end
- end
- end
- end
- if turtle.getItemCount(h) > 63 then
- turtle.select(h)
- if turtle.getItemCount(2) > 32 and turtle.getItemCount(3) > 32 and turtle.getItemCount(4) > 32 then
- if turtle.compareTo(1) then
- tomuchseeds=turtle.getItemCount(h)
- turtle.transferTo(13,tomuchseeds)
- turtle.transferTo(14,tomuchseeds)
- turtle.transferTo(15,tomuchseeds)
- end
- end
- if not turtle.compareTo(1) then
- if h < o and turtle.getItemCount(h) > 0 then
- wheatspace=64-turtle.getItemCount(o)
- if wheatspace > 1 then
- if turtle.getItemCount(h) < wheatspace then
- wheatharvest=turtle.getItemCount(h)
- turtle.transferTo(o,wheatharvest)
- else
- turtle.transferTo(o,wheatspace)
- v=o+1
- wheatspace=64-turtle.getItemCount(v)
- while turtle.getItemCount(h) > 1 do
- turtle.transferTo(v,wheatspace)
- if turtle.getItemCount(v) > 63 then
- v=v+1
- if v > 15 then
- return
- end
- end
- end
- end
- else
- v=o+1
- wheatspace=64-turtle.getItemCount(v)
- while turtle.getItemCount(h) > 1 do
- turtle.transferTo(v,wheatspace)
- if turtle.getItemCount(v) > 63 then
- v=v+1
- if v > 15 then
- return
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- function drop()
- for i=o,15 do
- turtle.select(i)
- turtle.drop()
- end
- end
- function Seeds()
- if turtle.getItemCount(e) < 1 then
- while turtle.getItemCount(1) < 1 do
- shell.run("clear")
- print("Need some Seeds in first Slot to start.")
- print("Continue if you inserted some")
- print("")
- write("Press ENTER to continue")
- read()
- if turtle.getItemCount(1) < 1 then
- print("")
- print("can't start without having Seeds in Slot 1")
- print("The Turtle needs at least 1 of them to")
- print("separate Seeds from Wheat.")
- print("")
- print("Insert now some Seeds in Slot 1")
- print("")
- write("Press ENTER to continue")
- read()
- end
- end
- end
- if turtle.getItemCount(1) > 1 then
- eh=turtle.getItemCount(1)-1
- turtle.select(1)
- turtle.transferTo(15,eh)
- end
- end
- -- functions end --
- reboot()
- e=2
- r=0
- r2=0
- f=0
- check()
- if not fs.exists("farmfirststart") then
- file=fs.open("farmfirststart","w")
- file.writeLine(x)
- file.writeLine(z)
- file.close()
- farm()
- elseif fs.exists("farmfirststart") then
- file=fs.open("farmfirststart","r")
- x=tonumber(file.readLine())
- z=tonumber(file.readLine())
- file.close()
- end
- while true do
- if turtle.getItemCount(16) < 1 then
- reboot()
- end
- farm()
- Seeds()
- while z > 0 do
- while x > 0 do
- turtle.select(5)
- turtle.digDown()
- turtle.digDown()
- turtle.suckDown()
- turtle.suckDown()
- sort()
- check()
- turtle.placeDown()
- if x > 1 then
- forward()
- end
- x=x-1
- r2=r2+1
- end
- while r2 > 0 do
- x=x+1
- r2=r2-1
- end
- r=r+1
- z=z-1
- if z > 0 then
- if f < 1 then
- turtle.turnRight()
- forward()
- turtle.turnRight()
- f=1
- elseif f > 0 then
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- f=0
- end
- end
- end
- turtle.turnRight()
- while r > 0 do
- if r > 1 then
- forward()
- end
- r=r-1
- z=z+1
- end
- drop()
- turtle.turnRight()
- f=0
- for t=1,3000 do
- term.setCursorPos(1,6)
- print(" ")
- term.setCursorPos(1,6)
- count=3000-t
- print("Sleeping for "..count.." Seconds.")
- sleep(1)
- end
- end
Add Comment
Please, Sign In to add comment