Lines 95-100 seem off.
It's not following the logic of the libGDX version at all.