I would do it by creating a subclass of FallingBlock (if it is still called that) and adding a targetHeight field, then making the block "fall" or "rise" to meet that height, before turning into the specified block. That way most of the code should be reusable from the parent class.
You will have to register it as a new EntityType.
Then when your block rises, you create a new instance of your entity, with the targetHeight one block higher than the current y position.
Show where you register your capability.
And this "Oh, it's null... guess I'll do nothing then and not report this error" behavior is terrible. This is not PHP. If something so fundamental is wrong, throw an exception! Crashing the game is OK if your code has bugs. Don't try to sweep the errors under the rug. It makes things way more hard to debug.