Guest User

farm

a guest
Mar 11th, 2026
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 KB | None | 0 0
  1. os.setComputerLabel("farmer")
  2. function farm()
  3.  shell.run("clear")
  4.  print("Farm Programm by M3veronMast3r")
  5.  print("------------------------------")
  6.  print("   !!!-WORK IN PROGRESS-!!!")
  7.  print("Sent all Fails to +491748274510")
  8. end
  9.  
  10. -- Settings --
  11. -- laenge:
  12. x= 9
  13. -- breite: (MUSS EINE GERADE ZAHL SEIN)
  14. z= 10
  15.  
  16. -- functions --
  17.  
  18. function forward()
  19.  while not turtle.forward() do
  20.   sleep(1)
  21.  end
  22. end
  23.  
  24. function back()
  25.  while not turtle.back() do
  26.   sleep(1)
  27.  end
  28. end
  29.  
  30. function reboot()
  31.  while turtle.getItemCount(16) < 1 do
  32.   shell.run("clear")
  33.   print("Need Chest in Slot 16")
  34.   sleep(1)
  35.  end
  36.  shell.run("clear")
  37.  print("starting Farm Programm..")
  38.  turtle.select(16)
  39.  while not turtle.compare() do
  40.   while not turtle.detect() do
  41.    forward()
  42.   end
  43.   if turtle.compare() then
  44.   else
  45.    turtle.turnRight()
  46.   end
  47.  end
  48.  turtle.turnRight()
  49.  farm()
  50. end
  51.  
  52. function check()
  53.  if turtle.getItemCount(e) < 1 then
  54.   while turtle.getItemCount(e) < 1 do
  55.    e=e+1
  56.    if e > 15 then
  57.     e=1
  58.     turtle.select(e)
  59.     return
  60.    end
  61.   end
  62.  end
  63.  turtle.select(e)
  64. end
  65.  
  66. function drop()
  67.  for i=5,15 do
  68.   turtle.select(i)
  69.   turtle.drop()
  70.  end
  71. end
  72. -- functions end --
  73. reboot()
  74. e=1
  75. r=0
  76. r2=0
  77. f=0
  78. check()
  79. if turtle.getItemCount(e) < 1 then
  80.  if not fs.exists("farmfirststart") then
  81.   shell.run("clear")
  82.   print("Need some Potatoes or Carrots for first start. Continue if you inserted some or planted")
  83.   print("")
  84.   write("Press ENTER to continue")
  85.   read()
  86.   fs.open("farmfirststart","w")
  87.   farm()
  88.  end
  89. end
  90. while true do
  91.  while z > 0 do
  92.   while x > 0 do
  93.    check()
  94.    if turtle.detectDown() then
  95.     local success, block = turtle.inspectDown()
  96.     if block.name == "minecraft:potatoes" then
  97.      if block.state.age > 6 then
  98.       turtle.digDown("left")
  99.       turtle.placeDown()
  100.      end
  101.     elseif block.name == "minecraft:carrots" then
  102.      if block.state.age > 6 then
  103.       turtle.digDown("left")
  104.       turtle.placeDown()
  105.      end
  106.     end
  107.    else
  108.     turtle.digDown("left")
  109.     turtle.placeDown()
  110.    end
  111.    if x > 1 then
  112.     forward()
  113.    end
  114.    x=x-1
  115.    r2=r2+1
  116.   end
  117.   while r2 > 0 do
  118.    x=x+1
  119.    r2=r2-1
  120.   end
  121.   r=r+1
  122.   z=z-1
  123.   if z > 0 then
  124.    if f < 1 then
  125.     turtle.turnRight()
  126.     forward()
  127.     turtle.turnRight()
  128.     f=1
  129.    elseif f > 0 then
  130.     turtle.turnLeft()
  131.     forward()
  132.     turtle.turnLeft()
  133.     f=0
  134.    end
  135.   end
  136.  end
  137.  turtle.turnRight()
  138.  while r > 0 do
  139.   if r > 1 then
  140.    forward()
  141.   end
  142.   r=r-1
  143.   z=z+1
  144.  end
  145.  drop()
  146.  turtle.turnRight()
  147.  f=0
  148.  sleep(3300)
  149. end
  150.  
Advertisement
Add Comment
Please, Sign In to add comment