This code, in an item's onItemRightClick:
log.info("onItemRightClick: getPosition {}, getPositionEyes {}, getPositionVector {}, player entity {}", playerIn.getPosition(), playerIn.getPositionEyes(1), playerIn.getPositionVector(), playerIn);
Result:
[19:38:54] [Client thread/INFO] [PosTest]: onItemRightClick: getPosition BlockPos{x=582, y=4, z=137}, getPositionEyes (581.5160287599339, 5.620000004768372, 136.53055861822787), getPositionVector (581.5160287599339, 4.0, 136.53055861822787), player entity EntityPlayerSP['Player921'/132, l='MpServer', x=581.52, y=4.00, z=136.53]
[19:38:54] [server thread/INFO] [PosTest]: onItemRightClick: getPosition BlockPos{x=581, y=4, z=136}, getPositionEyes (581.5160287599339, 5.620000004768372, 136.53055861822787), getPositionVector (581.5160287599339, 4.0, 136.53055861822787), player entity EntityPlayerMP['Player921'/132, l='New World', x=581.52, y=4.00, z=136.53]
As you can see with the output of getPositionVector the client and server agree exactly on where the player is. Yet the output of getPosition is off.
The implementation in EntityPlayerSP:
public BlockPos getPosition()
{
return new BlockPos(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D);
}
And in EntityPlayerMP:
public BlockPos getPosition()
{
return new BlockPos(this.posX, this.posY + 0.5D, this.posZ);
}
I guess this is a bug in Minecraft itself? Or is there a point to it?