It seems that animal mobs (sheeps, cows, pigs) are trying to break out of my fence instead of going in the middle and moving around. This makes it really frustrating when trying to mate the animals because they break out right when I open the fence gate. Is there a way that I can keep them from scrunching up on the side of the fence and frustrating me, or is this something I'll have to deal with?
There are only a handful of things that can compel a passive mob to move in a specific direction:
- Light, so if your pen is dark they may be moving towards lighter areas.
- Grass, so if your pen floor only has dirt or stone they may be moving towards "greener pastures". This could easily happen with sheep, since they eat the grass and it needs time to grow back.
- Wheat, so if you're holding wheat you need to switch to another item to safely get in your pen gate.
As mentioned above, putting a light source in the center of the pen will attract them and keep them away from the edges. Alternatively, you can remove your gate, and replace that section of the fence with wood blocks however high your pen is. You can then put ladder on the inside and outside of those blocks, so you can climb in and out, but the animals are permanently trapped.
Side note: I have left the gate on my pen, and placed the blocks with ladders NEXT to the gate. This is useful because it means you still have a gate in the event that you accidentally kill one of your animal species down to a population of 1 and they can't mate, leaving you with no other choice but to lure in more of that animal.
I heard knocking out a section of the fence and replacing it with nether brick fence instead of fence gate makes it so you can pass through but animals cant. please note ive never tried this myself so it may not work. horses cant pass through gates, theyre not programmed to pass through gates yet, so dont worry about them.