Routine Cleanup of Falling Blocks Datapack [for 1.21.1]

#################
## Description ##
#################

A datapack that runs every half hour to determine if there is an excessive number of falling_blocks (>100). If so, kills ALL of them immediately.

################
## Background ##
################

While trying to resolve a performance problem with a huge mod pack (450+), I discovered that my world had a ton of entities through the Spark mod. Not a significant number of villagers or birds or zombies, but over 3500 falling_block entities were loaded! Just look at this lovely log line:

BEFORE -> [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 29013ms or 580 ticks behind

Confounded by the lack of documentation on this, I fumbled around with the Internets until I discovered https://www.reddit.com/r/admincraft/comments/muw8zk/new_lag_chunk_ban_exploit_with_sand/, where the author 'blockswerker' had a helpful command for dealing with falling block exploits in their unrelated server issue. So, I fired that command into the console and my lag instantly cleared. I mean, there's a tiny bit of lag here and there, but the results are conclusive...

AFTER -> [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 4260ms or 85 ticks behind (this is also while flying around in creative loading a lot of chunks while trying to get this mod running

The natural thing to do is to find a mod that solved this problem. Doesn't exist. I'm running a Fabric server, so no easy scheduler mod. Then I learned about datapacks and %*I&EUY$ this was an awful experience to get working with near-zero knowledge of how this stuff works.

I imagine that with minor tweaking of the embedded commands, you can back-port or forward-port this to fit your needs. It's also an acceptable (not really a scheduler) tutorial on how to reliabily run commands using a infinite timer.

So, this is my first 'mod' I guess for MC. Maybe there's a better way. I hope it helps.



#############
## Install ##
#############

1. Before installing, either run a Spark profiler job and check your entities count for 'falling_blocks', or you can run these commands in sequence to verify you have a large quantity of 'falling_blocks' and need this tool.
      a: scoreboard objectives add testEntityCount dummy
      b: scoreboard players set @s testEntityCount 0
      c. execute as @e[type=falling_block] run scoreboard players add @p testEntityCount 1
      d. tellraw @s [{"score":{"name":"@a","objective":"testEntityCount"}}," falling_block entities loaded"]

1. Download.
2A. For single player or self-hosted LAN users: place into your 'saves/<your world>/datapacks' folder
2B. For dedicated servers, place into your server World/Datapacks folder