Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local automata = peripheral.find("weakAutomata")
- if not automata then error("Automata nicht gefunden!") end
- -- EINSTELLUNGEN
- local apricornName = "cobblemon:red_apricorn" -- Hier den genauen Namen anpassen
- local hoehe = 5
- local reifeStufe = 3
- local wartezeit = 180 -- 3 Minuten
- -- Funktion zum restlosen Einsammeln
- local function collectAll()
- for i = 1, 4 do
- turtle.suck()
- end
- end
- -- Funktion zum Entladen in eine Truhe
- local function unloadToChest()
- local success, block = turtle.inspectUp()
- if success and block.name:find("chest") then
- print("Chest gefunden. Entlade Inventar...")
- for slot = 1, 16 do
- turtle.select(slot)
- if turtle.getItemCount(slot) > 0 then
- turtle.dropUp()
- end
- end
- turtle.select(1)
- else
- print("Keine Chest oben gefunden.")
- end
- end
- -- HAUPTSCHLEIFE
- while true do
- print("--- Programm Start ---")
- -- 1. SICHERHEITS-CHECK
- print("Suche Startposition (oben)...")
- while not turtle.detectUp() do
- if not turtle.up() then
- if turtle.getFuelLevel() == 0 then error("Kein Treibstoff!") end
- break
- end
- end
- print("Startposition erreicht.")
- -- 2. ERNTEVORGANG
- for i = 1, hoehe do
- print("Checke Level " .. i)
- local success, block = turtle.inspect()
- local retryReported = false
- -- Pruefung auf Name UND Reife
- if success and block.name == apricornName and block.state and tonumber(block.state.age) >= reifeStufe then
- while success and block.name == apricornName and block.state and tonumber(block.state.age) >= reifeStufe do
- automata.useOnBlock()
- collectAll()
- sleep(0.5)
- success, block = turtle.inspect()
- if success and block.name == apricornName and block.state and tonumber(block.state.age) >= reifeStufe then
- if not retryReported then
- print("Fehlgeschlagen. Probiere erneut...")
- retryReported = true
- end
- end
- end
- print("Erfolgreich!")
- end
- -- Abwaertsbewegung
- if i < hoehe then
- while not turtle.down() do
- if turtle.getFuelLevel() == 0 then error("Kein Treibstoff!") end
- sleep(1)
- end
- end
- end
- -- 3. ZURUECK NACH OBEN UND ENTLADEN
- print("Fahre hoch zum Entladen.")
- for i = 1, hoehe - 1 do
- while not turtle.up() do sleep(1) end
- end
- unloadToChest()
- print("Vorgang beendet. Warte 3 Minuten...")
- sleep(wartezeit)
- end
Advertisement
Add Comment
Please, Sign In to add comment