Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- KONFIGURATION (Exakte Namen laut deiner Analyse)
- local itemName = "advancedperipherals:weak_automata_core"
- local automataType = "weakAutomata"
- local targetEntity = "Enderman"
- -- Hilfsfunktion: Sucht einen Slot mit dem Item
- local function findItemSlot(name)
- for i = 1, 16 do
- local detail = turtle.getItemDetail(i)
- if detail and detail.name == name then
- return i
- end
- end
- return nil
- end
- -- Hilfsfunktion: Inventar saeubern
- local function cleanup()
- print("System: Bereinige Inventar...")
- for i = 1, 16 do
- local detail = turtle.getItemDetail(i)
- if detail and detail.name ~= itemName then
- turtle.select(i)
- turtle.dropDown()
- end
- end
- end
- -- Hilfsfunktion: Erkennt das ausgeruestete Modul
- local function getEquippedAutomata()
- local sides = {"left", "right"}
- for _, side in ipairs(sides) do
- if peripheral.getType(side) == automataType then
- return peripheral.wrap(side), side
- end
- end
- return nil, nil
- end
- -- HAUPTSCHLEIFE
- while true do
- -- 1. Vorbereitung: Brauchen wir Nachschub von oben?
- if not findItemSlot(itemName) then
- print("Log: Suche Nachschub in der Truhe oben...")
- turtle.suckUp()
- end
- -- 2. Werkzeug-Check: Ist das weakAutomata-Modul ausgeruestet?
- local automata, side = getEquippedAutomata()
- if not automata then
- local slot = findItemSlot(itemName)
- if slot then
- turtle.select(slot)
- turtle.equipRight()
- print("Werkzeug: weakAutomata Modul ausgeruestet.")
- automata, side = getEquippedAutomata()
- else
- print("Fehler: Kein weak_automate_core fuer Ausruestung gefunden!")
- break
- end
- end
- -- 3. Ziel-Slot waehlen: Der Core im Slot wird umgewandelt
- local workSlot = findItemSlot(itemName)
- if not workSlot then
- print("Ende: Keine Cores mehr zum Umwandeln da.")
- break
- end
- turtle.select(workSlot)
- print("Aktiv: Core in Slot " .. workSlot .. " wird gefuettert...")
- -- 4. Sammel-Loop fuer den ausgewaehlten Slot
- while true do
- -- Cooldown beachten (Sicherung gegen NIL)
- local cd = automata.getOperationCooldown("feed_soul") or 0
- if cd > 0 then sleep(cd / 1000 + 0.1) end
- -- Entity-Check (Enderman Sichtpruefung)
- local entities = automata.lookAtEntity()
- local found = false
- if entities and type(entities) == "table" then
- for _, e in ipairs(entities) do
- if e.name and e.name:find(targetEntity) then
- found = true
- break
- end
- end
- end
- if found then
- local success, msg = automata.feedSoul()
- if success then
- print("Soul Success! Seele absorbiert.")
- end
- end
- -- WICHTIG: Pruefen, ob sich der Core im Slot verwandelt hat
- local item = turtle.getItemDetail(workSlot)
- if not item or item.name ~= itemName then
- print("Upgrade: Core hat sich zum End-Modul verwandelt!")
- -- Das fertige Item nach unten ablegen
- turtle.dropDown()
- break
- end
- -- Wenn kein Enderman da ist, kurz warten
- if not found then sleep(0.5) end
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment