Fixed problems with chunk rendering in Firefox & added distanctToRectCenter function for each entity.