At what distance (from the player) do iron golems spawn in villages?
I'm planning on building an iron golem farm in Minecraft 1.8, and I want to know how far from my base it can be and still work. All the information I've found related to mob spawning deals with hostile mobs, e.g. the 24-block minimum distance for spawning and the 128-block despawn distance, but those rules don't apply to golems. I haven't found anything describing the distance at which the special village golem spawning happens.
I built a simple test golem farm in creative mode and found that at a distance of roughly 200 blocks taxicab, 140 Euclidean, it doesn't seem to work: I waited about 20 minutes and got no iron. But it works when I'm closer. I could probably determine the threshold distance through trial and error, but that's slow and unreliable (since golems spawn infrequently and irregularly), so I'm hoping someone knows what the actual rules are.
This problem is caused by chunk unloading. Once you are far, the chunk with the spawner in it is unloaded from memory thus unable to provide you with iron golems or their drops. Try to shift your farm to spawn chunk and check if it starts working, as spawn chunks always remain loaded in memory.
This means, for instance, that redstone machines and iron golem farms will only work if a player is nearby. This can make effective farming difficult when the player spends a lot of time exploring or in another dimension. Since spawn chunks do not get unloaded, they continue to process events, even when no players are nearby.
From Minecraft Wikia
There is literally zero direct dependence between golem spawning an player location currently (1.15-1.16). As long as the villagers are loaded and in entity-processing chunks, golems can spawn, and they can spawn both practically on top of the player, with player very far, and with no player at all.
Of course for the last case you need some alternative means of keeping the iron farm loaded - at current time there are three vanilla means - first, non-survival: using the /forceload command to define a permaloaded zone, second - might be subject to admin-imposed restrictions or server land claims: build the farm in the spawn chunks, and third, possible in practically any circumstances unless expressly forbidden, build a permaloader.
For example: this iron farm, located a considerable distance from spawn, produces iron 24/7 thanks the permaloader device located deep down near bedrock (the location is chosen to reduce chance of interference with other portals; another alternative is up in the sky near build limit).