Put down a fence, a glass pane, and pretty much any block (or glass pane) in a line on the ground. The player can walk through it, but cows, pigs and sheep cannot. Remember to make the glass pane two blocks tall so they cant jump over it. Both of these are totally mobproof:
EDIT: Works for sheep and pigs as well as cows. But not for chickens.
I think there are problems using fences and glass panes because they allow animals to spawn on the wrong side when you restart/reenter an area. you will experience stock loss.
Rollback Post to RevisionRollBack
As without so within. ~~~
You don't need a spiritual leader to achieve enlightenment.
I also wonder about them glitching out of the fenced area when you reload the game. My solution to that has been to put my farm animals in a pit which is 2 blocks deep and put a fence around the top perimeter of the pit. To get in and out I use a ladder leading up to a gate.
No, they won't glitch out when you reload the game, but they do occasionally with breeding, the same as normal fences. They probably would glitch out in SMP. And yes, it does work with sheep, and pigs. Chickens are too small.
EDIT: Works for sheep and pigs as well as cows. But not for chickens.
http://www.youtube.com/n0ah1897
You don't need a spiritual leader to achieve enlightenment.
Always willing to help. Message me.