Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local scanner = peripheral.find("geoScanner")
- if not scanner then error("Geo Scanner nicht gefunden!") end
- local radius = 10
- -- Namen-Zuordnung für schoenere Anzeige (optional erweiterbar)
- local oreNames = {
- ["minecraft:iron_ore"] = "Eisen",
- ["minecraft:deepslate_iron_ore"] = "Eisen",
- ["minecraft:coal_ore"] = "Kohle",
- ["minecraft:deepslate_coal_ore"] = "Kohle",
- ["minecraft:diamond_ore"] = "Diamant",
- ["minecraft:deepslate_diamond_ore"] = "Diamant",
- ["minecraft:gold_ore"] = "Gold",
- ["minecraft:deepslate_gold_ore"] = "Gold",
- ["minecraft:copper_ore"] = "Kupfer",
- ["minecraft:deepslate_copper_ore"] = "Kupfer",
- ["minecraft:redstone_ore"] = "Redstone",
- ["minecraft:deepslate_redstone_ore"] = "Redstone",
- ["minecraft:emerald_ore"] = "Smaragd",
- ["minecraft:deepslate_emerald_ore"] = "Smaragd",
- ["minecraft:lapis_ore"] = "Lapis",
- ["minecraft:deepslate_lapis_ore"] = "Lapis",
- ["minecraft:nether_gold_ore"] = "Gold",
- ["minecraft:nether_quartz_ore"] = "Quartz",
- ["tconstruct:cobalt_ore"] = "Cobalt",
- ["cobblemon:deepslate_fire_stone_ore"] = "FireStone",
- ["cobblemon:nether_fire_stone_ore"] = "FireStone",
- ["cobblemon:fire_stone_ore"] = "FireStone"
- }
- -- Funktion: Wandelt Koordinaten in Richtungs-Strings um
- local function getDirection(x, y, z)
- local dir = ""
- -- Z-Achse (Nord/Sued)
- if z < 0 then dir = dir .. math.abs(z) .. "N "
- elseif z > 0 then dir = dir .. z .. "S " end
- -- X-Achse (West/Ost)
- if x < 0 then dir = dir .. math.abs(x) .. "W "
- elseif x > 0 then dir = dir .. x .. "O " end
- -- Y-Achse (Oben/Unten)
- if y < 0 then dir = dir .. math.abs(y) .. "D"
- elseif y > 0 then dir = dir .. y .. "U" end
- return dir
- end
- -- HAUPTSCHLEIFE
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("=== ERZ TRACKER (Radius " .. radius .. ") ===")
- local data = scanner.scan(radius)
- local results = {}
- if data then
- for _, block in ipairs(data) do
- local name = block.name:lower()
- if name:find("ore") or name:find("raw") or name:find("ancient") or name:find("crystal") then
- -- Namen verschönern
- local displayName = oreNames[block.name] or block.name:match(":(.+)") or block.name
- -- Nur das jeweils naechste Erz jeder Art speichern
- if not results[displayName] then
- results[displayName] = block
- else
- -- Wenn dieser Block naeher ist als der bisher gespeicherte, ersetzen
- local currentDist = math.abs(block.x) + math.abs(block.y) + math.abs(block.z)
- local old = results[displayName]
- local oldDist = math.abs(old.x) + math.abs(old.y) + math.abs(old.z)
- if currentDist < oldDist then
- results[displayName] = block
- end
- end
- end
- end
- -- Ergebnisse ausgeben
- local line = 2
- for name, pos in pairs(results) do
- if line < 15 then -- Stoppt, bevor das Display voll ist
- term.setCursorPos(1, line)
- local dirString = getDirection(pos.x, pos.y, pos.z)
- print(name:sub(1,1):upper() .. name:sub(2) .. ": " .. dirString)
- line = line + 1
- end
- end
- if line == 2 then
- print("Keine Erze gefunden.")
- end
- else
- print("Scan fehlgeschlagen (Cooldown?)")
- end
- print("\n[Warte auf naechsten Scan...]")
- sleep(4) -- Pause zwischen den Scans (Cooldown-Schutz)
- end
Advertisement
Add Comment
Please, Sign In to add comment