I've built a fenced area in Minecraft in which cows, pigs and over wildlife I intend to congregate. Only problem, how can I make them happy? In that they quite often bounce by the fence, wanting to get out. Any recommendations?
Cows (along with all passive mobs) have no AI other than "wander". They will blissfully stumble head-first into lava if given the chance.
As of 1.6.6, there is no way to encourage Passive Mobs to stick around; even "happy" cows will disappear into the ether if you wander far enough away that the chunk gets unloaded from Memory.
On the other hand, fence-escaping can simply be halted by making the fence taller.
As of 1.8, passive mobs no longer despawn. If you fence a cow, sheep, or pig, and keep them safe from wolves / aggressive mobs, they should stay fenced-in indefinitely.
You can prevent the cows bouncing by simply making the fence taller. Their pathing AI seems to think they can make what should be a one block jump; however, the fences' unusual collision check ends up blocking them. Thus, they start bouncing whenever they wander near.
You can't make them stay though, they will despawn eventually (as of 1.6.6).