Advertisement
Gorocker

Untitled

May 19th, 2024 (edited)
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. Scanner = peripheral.wrap("back")
  2.  
  3. while true do
  4.     term.clear()
  5.     term.setCursorPos(1, 1)
  6.  
  7.     Blocks, Err = Scanner.scan(16)
  8.     Found = false
  9.  
  10.     for id, block in pairs(Blocks) do
  11.         if string.match(block["name"], "allthemodium") then
  12.             Found = true
  13.             term.setTextColor(colors.green)
  14.             term.write(block["name"])
  15.             term.setTextColor(colors.white)
  16.             term.write(" at ")
  17.             term.setTextColor(colors.blue)
  18.             print(string.format("x:%d z:%d y:%d", block["x"], block["z"], block["y"]))
  19.             local x = block["x"]
  20.             local y = block["z"]
  21.             local len = math.sqrt(math.pow(x,2) + math.pow(y,2))
  22.             x = x / len
  23.             y = y / len
  24.             print(string.format("x:%d z:%d", x, y))
  25.         end
  26.     end
  27.     if not Found then
  28.         print(os.clock())
  29.         print("Nothing found")
  30.     end
  31.     sleep(5)
  32. end
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement