To fix your Minecraft world so that the coordinates displayed on the F3 debugging screen match what the MCPI API tells you with
player.getTilePos(), issue this Command in the game (requires Multiplayer, or a World generated with Cheat Codes enabled):
/setworldspawn 0 0 0
(to do this, press T or / and then type
/setw followed by the TAB key, and then 0 0 0. For some reason you can't type this command out in full on the Talk window.)
An explanation is given in the discusson on the Stuff about code MCAPI reference. Breifly, the coordinates that the MCPI API returns with
player.getTilePos() are relative to the Minecraft World Spawn Point.
This is why they don't match what you see if you press the F3 key in the Minecraft game: those are the absolute coordinates in the world. The World Spawn Point is different to the Player Spawn Point also, so resetting the player's spawn (with a
/setspawn command, or by building a bed and sleeping) will not change the coordinates returned by the the API.