Find height for every block in given area [closed]

I want to find height for every block in given area (several hundred/thousands blocks).

Here is example: enter image description here

It's 2x2 area and I can do it manually and we get: 3 blocks with 68 height and 1 block with 69 height but in high scale 1000x1000 for example it would take ages to do it manually.

Is there any tools/mods/anything to do that?

I need it to find best height to start flattering area.


You could copy the entire area somewhere else using /clone and then use this command on the copied area:

/execute store result score @s <scoreboard_name> run fill <lower_coords> <higher_coords> air

… with <scoreboard_name>, <lower_coords> and <higher_coords> replaced with the corresponding parts.

This stores the number of blocks there are in the area (above a certain height, if you start cloning higher up) in the scoreboard. If you just want the number displayed in text, you can also just run /fill <lower_coords> <higher_coords> air.