The Meaning of Life, the Universe, and Everything.
So... um... yesterday I just randomly decided to make an ore scanner and so I sort of did.
I decided to shorten it to just diamonds though so it wouldn't take weeks to make.
Basically you have an item frame named "Diamond Scanner" and when you hold it, it scans for nearby diamonds and broadcasts how many it finds in chat (says it even if it finds 0 diamonds). It uses 499 741 command blocks and 4 scoreboard objectives.
How is works (basically):
It is constantly checking to see if you are holding the scanner. If you are, it activates a ton of command blocks detecting individual blocks nearby for diamond ore. For each one found, it adds 1 to a certain scoreboard objective. ~0.2 seconds later it announces how many diamond ore was found by checking what number the objective is, and if the objective is at least 1 a "ding" like sound is played (the sound can be toggled on/off via a lever located in the redstone area). Then it resets the diamond count score (the rest of the objectives are reset over the course of the scanning).
Picture of the redstone:
Detecting the ten diamond ore:
Scanning 2 diamond ore underground:
Picture with stone representing the scan area and the armorstand representing the player: