Skip to main content
2 of 2
added 3 characters in body
pinckerman
  • 43.9k
  • 23
  • 132
  • 195

I do not know if there is a good way of doing this but I have used a trick to detect block-breaking to replace them with water for an underwater map.

The trick uses the fact that Java Edition has three different types of air: blocks_air, cave_air and void_air (these are used for terrain generation). When you break a block it always gets replaced with the normal air. So I used a fill command executed around the player every tick to replace the normal air with water. Then if I wanted to have air I used cave_air which would not get replaced.

In your case you could replace the blocks with cave air instead of water then you can probably store the success of that fill function to a scoreboard to see if a block is broken.

Note that this would mean you need to convert the air to cave_air in the first place. You can probably do that by having like a hollow cube around the player bigger than its reach where you replace the air with cave_air.

This will tell you when a block is broken. Not what block, so you would have to keep track of what block a player is looking at at all times.