This might be better fixed by adding +0.5 to the player position. I suspect the behaviour you describe was due to the fact that the player's position describes the *center* of the player (technically camera position, but same as center on the xz plane), while block coordinates describe the lowest corner of the block.