How does Minecraft determine the spawn location in a seeded world?

I was wondering if there is any rhyme or reason behind where you spawn in SSP in Minecraft after seeding your world.

From my first hand experience, the answer is yes you always spawn with the same x,y co-ordinates on a seed. But I wondered when this came in, and whether what I've seen is backed up by anything (and not just circumstantial).


Solution 1:

The Minecraft Wiki article on Spawning is a good start. Specifically;

Every world has a "spawn point" (really, an area) located within a few hundred blocks of the origin (0x, 0y, 0z). This point is stored in the level.dat file's SpawnX, SpawnY, SpawnZ attributes (although SpawnY seems to be ignored). If the spawn point is deemed unacceptable, a new, temporary spawn point will be selected (although the criteria for "unacceptable" is unknown).

So you always spawn "somewhere" near the center of the map (0,0). Generally the game will try to spawn you on a sand tile near water (The "washed ashore" effect). So, if you always load the same seed, then the algorithm should always plop you down in the same spot that is "close to" the center of the map.

The rules for multiplayer are somewhat different however, and the article is worth the read on that aspect.

Solution 2:

I've actually tested this... unless I wrote my seed numbers down wrong you do not always spawn in the same area. I deleted a world I had been work on for a while because I got frustrated with it. When I created the world again I haven't been able to find the village I used last time I played this seed is no where near where I've been spawning and when I first played this seed it was VERY close to my spawn point. So no, this is no longer true. It's also happened with 5 other seeds.