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!
For the extremly improbable case that the z coordinates of the cart and the other entity are exacly the same the program would crash because it would divide by zero (line 887/8). I know it's kinda clumsy.