Advertisement
ElijahCrafter

Geo Scanner

Mar 2nd, 2024
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. -- Ore Locator Script using Advanced Peripherals Geo Scanner
  2.  
  3. -- Define the side where the Geo Scanner is connected
  4. local geoScannerSide = "top" -- Change this to match your setup
  5.  
  6. -- Load the Geo Scanner API
  7. os.loadAPI("geoScanner")
  8.  
  9. -- Function to scan for ores
  10. local function scanForOres()
  11.     local ores = {"minecraft:diamond_ore", "minecraft:emerald_ore"} -- List of ores to search for
  12.     local results = {} -- Table to store scan results
  13.    
  14.     -- Perform scans for each ore
  15.     for _, ore in ipairs(ores) do
  16.         local scanResult = geoScanner.scan(ore)
  17.         if scanResult then
  18.             table.insert(results, {ore = ore, position = scanResult})
  19.         end
  20.     end
  21.    
  22.     return results
  23. end
  24.  
  25. -- Function to display scan results
  26. local function displayResults(results)
  27.     print("Scan Results:")
  28.     for _, result in ipairs(results) do
  29.         print("Ore: " .. result.ore)
  30.         print("Position: " .. result.position.x .. ", " .. result.position.y .. ", " .. result.position.z)
  31.         print("--------------------------------")
  32.     end
  33. end
  34.  
  35. -- Main function
  36. local function main()
  37.     -- Check if Geo Scanner is present
  38.     if not peripheral.isPresent(geoScannerSide) or peripheral.getType(geoScannerSide) ~= "geoScanner" then
  39.         print("Geo Scanner not found on specified side.")
  40.         return
  41.     end
  42.    
  43.     -- Perform ore scan
  44.     local scanResults = scanForOres()
  45.    
  46.     -- Display results
  47.     displayResults(scanResults)
  48. end
  49.  
  50. -- Run main function
  51. main()
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement