What's the difference: getPos vs getTilePos?

189 views
Skip to first unread message

Bob Irving

unread,
Apr 13, 2016, 2:49:23 PM4/13/16
to Adventures in Minecraft Forum
I use this all the time to get the player's position (mc.player.getPos or getTilePos). But I don't know what the difference is.

Why use one over the other?

TIA,
Bob Irving
Porter-Gaud School
Charleston, SC

Martin O'Hanlon

unread,
Apr 14, 2016, 3:23:57 AM4/14/16
to Adventures in Minecraft Forum
Hi Bob,
  • getPos - gets the players position.
  • getTilePos - gets the position of the tile where the player is... The tile being the top of the block the player is standing on.
In more practical terms, if your standing the middle of block (1,1,1)
  • getPos - gives you a very precise position of the player as decimals (floats), and would return (1.5, 1.5, 1.5)
  • getTilePos - gives you the position of the block as integers, returing (1, 1, 1)
getTilePos is generally more useful if you want to use the players position to interact with blocks, getPos is generally better for tracking the players position.

Mart



Reply all
Reply to author
Forward
0 new messages