Nether Portal - How far away do I have to be for pigmen to spawn?

I want to build a Nether Portal farm, but I'm not sure how far away I can move from the farm so pigmen will still spawn.


Solution 1:

From the Wiki: http://minecraft.gamepedia.com/Spawn#Mob_spawning

Mobs spawn naturally within a square group of chunks centered on the player. In single- player mode, this area will be 15×15 chunks (240×240 blocks), but in multi-player mode the size can vary with the server settings. When there are multiple players, mobs can spawn within the given distance of any of them. However, hostile mobs (and some others) that move farther than 128 blocks from any player will soon despawn (see Despawning), so even with a larger chunk loading radius, the mob spawning area is more-or-less limited to spheres with a radius of 128 blocks, centered at each player.

Bottom line, the maximum spawn distance for Zombie Pig Men is 120 blocks away from you; however, the specific server settings could limit that even further.

Solution 2:

I know this question is 6 years old at this point, but I'm writing this answer because the other answer to this question (by Linuxmint) is an accurate summary of the set of rules for generic mob despawning, and should be taken into account when building a zombie pigman farm, but does not take into account any of the mechanics around Zombie pigmen spawning. Being a mob native to the nether, pigmen are subject to a unique set of spawning rules in the overworld, though they still contribute to the overworld hostile mob limit. They are only able to spawn in the overworld out of activated nether portals. According to the Minecraft wiki,

When a nether portal block in the Overworld receives a block tick, there is a small chance (1⁄2000 on Easy, 2⁄2000 on Normal, and 3⁄2000 on Hard) it spawns a zombie pigman on the bottom part of the portal frame.‌[Java Edition only] If a zombie pigman spawned in this way does not leave the portal it spawns on, there is a possibility of teleporting to the nether.

In Bedrock Edition, they appear near the overworld portal, not in it. Neither half slabs nor lighting prevents this.

Block ticks happen 20 times per second (assuming no lag), so we can extrapolate a 40/2000 or a 1/50 chance of a pigman being spawned by a portal portal block each second on normal. Since the pigman will always spawn on the bottom obsidian block in a portal frame, the height of the portal proportionally increases the chance of a spawn. For example, for a minimum size portal (2 wide by 3 tall), we get a 3/50 chance for each of the 2 blocks wide that the portal is, for a 6/50 or 3/25 chance per second of a pigman spawning per second. For a max size portal (internal size 21x21), we get a chance of 21/1000 per block width, for a total chance of 441/1000 per second. This is almost 2 pigmen per second for a maximum size portal, though I haven't been able to find any information on the chance of them moving before they get sucked back into the nether. It also may be worth noting for pigman farms that a max size nether portal has a chance of spawning ghasts, which could cause some problems for farms.