Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.setComputerLabel("farmer")
- function farm()
- shell.run("clear")
- print("Farm Programm by M3veronMast3r")
- print("------------------------------")
- print(" !!!-WORK IN PROGRESS-!!!")
- print("Sent all Fails to https://everding.com/")
- end
- -- Default Settings -- (gets updated back to original as long as updater is on)
- -- Use setup (remove chest from inv & reboot) to change value or turn off updater
- -- laenge:
- x= 12
- -- breite: (MUSS EINE GERADE ZAHL SEIN)
- z= 12
- -- functions --
- function setup()
- if fs.exists("farm_save") then
- file=fs.open(farm_save")
- x=file.readLine()
- y=file.readLine()
- file.close()
- else
- file=fs.open("farm_save")
- file.writeLine(x)
- file.writeLine(y)
- file.close()
- end
- if turtle.getItemCount(16) < 1 then
- shell.run("clear")
- print("want to change default lenght:12 and default width:12?")
- print("write Y for yes or anything else for No")
- write(">>: ")
- text=read()
- if #tArgs(text) == 1 then
- if text == "Y" then
- print("x: ")
- yx = tonumber(io.read)
- print("y: ")
- yy = tonumber(io.read)
- print("Your set X="..yx.." and your set Y="..yy..". Is that Correct?")
- print("write Y for yes or anything else for No")
- write(">>: ")
- text=read()
- if #tArgs(text) == 1 then
- if text == "Y" then
- y = yy
- x = yx
- file=fs.open("farm_save","w")
- file.writeLine(x)
- file.writeLine(y)
- file.close()
- else
- setup()
- end
- else
- setup()
- end
- end
- end
- end
- end
- function forward()
- while not turtle.forward() do
- sleep(1)
- end
- end
- function back()
- while not turtle.back() do
- sleep(1)
- end
- end
- function reboot()
- if turtle.getItemCount(16) < 1 then
- setup()
- while turtle.getItemCount(16) < 1 do
- shell.run("clear")
- print("Need Chest in Slot 16")
- sleep(1)
- end
- end
- shell.run("clear")
- print("starting Farm Programm..")
- turtle.select(16)
- 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
- function check()
- if turtle.getItemCount(e) < 1 then
- while turtle.getItemCount(e) < 1 do
- e=e+1
- if e > 15 then
- e=1
- turtle.select(e)
- return
- end
- end
- end
- turtle.select(e)
- end
- function drop()
- for i=5,15 do
- turtle.select(i)
- turtle.drop()
- end
- end
- -- functions end --
- reboot()
- e=1
- r=0
- r2=0
- f=0
- check()
- if turtle.getItemCount(e) < 1 then
- if not fs.exists("farmfirststart") then
- shell.run("clear")
- print("Need some Potatoes or Carrots for first start. Continue if you inserted some or planted")
- print("")
- write("Press ENTER to continue")
- read()
- fs.open("farmfirststart","w")
- farm()
- end
- end
- while true do
- while z > 0 do
- while x > 0 do
- check()
- if turtle.detectDown() then
- local success, block = turtle.inspectDown()
- if block.name == "minecraft:potatoes" then
- if block.state.age > 6 then
- turtle.digDown("left")
- turtle.placeDown()
- end
- elseif block.name == "minecraft:carrots" then
- if block.state.age > 6 then
- turtle.digDown("left")
- turtle.placeDown()
- end
- end
- else
- turtle.digDown("left")
- turtle.placeDown()
- end
- 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
- sleep(3300)
- end
Advertisement
Add Comment
Please, Sign In to add comment