AnonymusHochgenuss

apricorn-farm

Mar 20th, 2026 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. local automata = peripheral.find("weakAutomata")
  2. if not automata then error("Automata nicht gefunden!") end
  3.  
  4. -- EINSTELLUNGEN
  5. local apricornName = "cobblemon:red_apricorn" -- Hier den genauen Namen anpassen
  6. local hoehe = 5
  7. local reifeStufe = 3
  8. local wartezeit = 180 -- 3 Minuten
  9.  
  10. -- Funktion zum restlosen Einsammeln
  11. local function collectAll()
  12. for i = 1, 4 do
  13. turtle.suck()
  14. end
  15. end
  16.  
  17. -- Funktion zum Entladen in eine Truhe
  18. local function unloadToChest()
  19. local success, block = turtle.inspectUp()
  20. if success and block.name:find("chest") then
  21. print("Chest gefunden. Entlade Inventar...")
  22. for slot = 1, 16 do
  23. turtle.select(slot)
  24. if turtle.getItemCount(slot) > 0 then
  25. turtle.dropUp()
  26. end
  27. end
  28. turtle.select(1)
  29. else
  30. print("Keine Chest oben gefunden.")
  31. end
  32. end
  33.  
  34. -- HAUPTSCHLEIFE
  35. while true do
  36. print("--- Programm Start ---")
  37.  
  38. -- 1. SICHERHEITS-CHECK
  39. print("Suche Startposition (oben)...")
  40. while not turtle.detectUp() do
  41. if not turtle.up() then
  42. if turtle.getFuelLevel() == 0 then error("Kein Treibstoff!") end
  43. break
  44. end
  45. end
  46. print("Startposition erreicht.")
  47.  
  48. -- 2. ERNTEVORGANG
  49. for i = 1, hoehe do
  50. print("Checke Level " .. i)
  51.  
  52. local success, block = turtle.inspect()
  53. local retryReported = false
  54.  
  55. -- Pruefung auf Name UND Reife
  56. if success and block.name == apricornName and block.state and tonumber(block.state.age) >= reifeStufe then
  57. while success and block.name == apricornName and block.state and tonumber(block.state.age) >= reifeStufe do
  58. automata.useOnBlock()
  59. collectAll()
  60. sleep(0.5)
  61.  
  62. success, block = turtle.inspect()
  63. if success and block.name == apricornName and block.state and tonumber(block.state.age) >= reifeStufe then
  64. if not retryReported then
  65. print("Fehlgeschlagen. Probiere erneut...")
  66. retryReported = true
  67. end
  68. end
  69. end
  70. print("Erfolgreich!")
  71. end
  72.  
  73. -- Abwaertsbewegung
  74. if i < hoehe then
  75. while not turtle.down() do
  76. if turtle.getFuelLevel() == 0 then error("Kein Treibstoff!") end
  77. sleep(1)
  78. end
  79. end
  80. end
  81.  
  82. -- 3. ZURUECK NACH OBEN UND ENTLADEN
  83. print("Fahre hoch zum Entladen.")
  84. for i = 1, hoehe - 1 do
  85. while not turtle.up() do sleep(1) end
  86. end
  87.  
  88. unloadToChest()
  89.  
  90. print("Vorgang beendet. Warte 3 Minuten...")
  91. sleep(wartezeit)
  92. end
Advertisement
Add Comment
Please, Sign In to add comment