Question
In a recent Yogscast video it was mentioned that you always spawn on sand in a new world, is this true?
Answer
Yes, you do always spawn on sand. Here's a few snippets of the source (decompiled by MCP):
From World.java,here's the function that gets called when opening a world:
protected void func_25098_c() {
findingSpawnPoint = true;
int i = 0;
byte byte0 = 64;
int j;
for (j = 0; !worldProvider.canCoordinateBeSpawn(i, j);) {
i += rand.nextInt(64) - rand.nextInt(64);
j += rand.nextInt(64) - rand.nextInt(64)
} worldInfo.setSpawn(i, byte0, j);
findingSpawnPoint = false;
}
From WorldProvider, the relevant function called:
public boolean canCoordinateBeSpawn(int i, int j) {
int k = worldObj.getFirstUncoveredBlock(i, j);
return k == Block.sand.blockID;
}
So, when Minecraft starts setting the spawn point, it begins at X/Z 0/0 and moves the point around randomly (with steps of at most 64 in the cardinal directions), until the topmost block at the spawn point is sand.
As to why this happens to be near sea-level (most of the time), I'm not sure, probably sand has a higher chance of generating there.
Check more discussion of this question.
No comments:
Post a Comment