Player entrance only (Invisible mob-proof wall)

Is there any way to create an invisible barrier that allows players to walk (and see) straight trough it, but make it a solid wall for other entities? If so, how?

Continue to help post