Implement ability to push minecarts on curved rails

This is my first real code contribution to an open source project. I'm grateful for any advice!
> if ( Distance.z == 0. ) Distance.z = 0.0001;
The old code wasn't good either as madmaxoft pointed out. It could divide by very small numbers, which can be fatal aswell

I don't see a more elegant version than this right now:
if (abs(Distance.z) < 0.001)
{
    Distance.z = 0.001
}