AnonymusHochgenuss

endautomata

Mar 27th, 2026 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. -- KONFIGURATION (Exakte Namen laut deiner Analyse)
  2. local itemName = "advancedperipherals:weak_automata_core"
  3. local automataType = "weakAutomata"
  4. local targetEntity = "Enderman"
  5.  
  6. -- Hilfsfunktion: Sucht einen Slot mit dem Item
  7. local function findItemSlot(name)
  8. for i = 1, 16 do
  9. local detail = turtle.getItemDetail(i)
  10. if detail and detail.name == name then
  11. return i
  12. end
  13. end
  14. return nil
  15. end
  16.  
  17. -- Hilfsfunktion: Inventar saeubern
  18. local function cleanup()
  19. print("System: Bereinige Inventar...")
  20. for i = 1, 16 do
  21. local detail = turtle.getItemDetail(i)
  22. if detail and detail.name ~= itemName then
  23. turtle.select(i)
  24. turtle.dropDown()
  25. end
  26. end
  27. end
  28.  
  29. -- Hilfsfunktion: Erkennt das ausgeruestete Modul
  30. local function getEquippedAutomata()
  31. local sides = {"left", "right"}
  32. for _, side in ipairs(sides) do
  33. if peripheral.getType(side) == automataType then
  34. return peripheral.wrap(side), side
  35. end
  36. end
  37. return nil, nil
  38. end
  39.  
  40. -- HAUPTSCHLEIFE
  41. while true do
  42. -- 1. Vorbereitung: Brauchen wir Nachschub von oben?
  43. if not findItemSlot(itemName) then
  44. print("Log: Suche Nachschub in der Truhe oben...")
  45. turtle.suckUp()
  46. end
  47.  
  48. -- 2. Werkzeug-Check: Ist das weakAutomata-Modul ausgeruestet?
  49. local automata, side = getEquippedAutomata()
  50. if not automata then
  51. local slot = findItemSlot(itemName)
  52. if slot then
  53. turtle.select(slot)
  54. turtle.equipRight()
  55. print("Werkzeug: weakAutomata Modul ausgeruestet.")
  56. automata, side = getEquippedAutomata()
  57. else
  58. print("Fehler: Kein weak_automate_core fuer Ausruestung gefunden!")
  59. break
  60. end
  61. end
  62.  
  63. -- 3. Ziel-Slot waehlen: Der Core im Slot wird umgewandelt
  64. local workSlot = findItemSlot(itemName)
  65. if not workSlot then
  66. print("Ende: Keine Cores mehr zum Umwandeln da.")
  67. break
  68. end
  69.  
  70. turtle.select(workSlot)
  71. print("Aktiv: Core in Slot " .. workSlot .. " wird gefuettert...")
  72.  
  73. -- 4. Sammel-Loop fuer den ausgewaehlten Slot
  74. while true do
  75. -- Cooldown beachten (Sicherung gegen NIL)
  76. local cd = automata.getOperationCooldown("feed_soul") or 0
  77. if cd > 0 then sleep(cd / 1000 + 0.1) end
  78.  
  79. -- Entity-Check (Enderman Sichtpruefung)
  80. local entities = automata.lookAtEntity()
  81. local found = false
  82. if entities and type(entities) == "table" then
  83. for _, e in ipairs(entities) do
  84. if e.name and e.name:find(targetEntity) then
  85. found = true
  86. break
  87. end
  88. end
  89. end
  90.  
  91. if found then
  92. local success, msg = automata.feedSoul()
  93. if success then
  94. print("Soul Success! Seele absorbiert.")
  95. end
  96. end
  97.  
  98. -- WICHTIG: Pruefen, ob sich der Core im Slot verwandelt hat
  99. local item = turtle.getItemDetail(workSlot)
  100. if not item or item.name ~= itemName then
  101. print("Upgrade: Core hat sich zum End-Modul verwandelt!")
  102. -- Das fertige Item nach unten ablegen
  103. turtle.dropDown()
  104. break
  105. end
  106.  
  107. -- Wenn kein Enderman da ist, kurz warten
  108. if not found then sleep(0.5) end
  109. end
  110.  
  111. sleep(0.5)
  112. end
Advertisement
Add Comment
Please, Sign In to add comment