So I have an understanding of Minecraft world dimensions from this very helpful gaming.SE post. A key point in this Notchism is the following,
"Terrain is generated, saved and loaded, and (kind of) rendered in chunks of 16*16*128 blocks."
So I wrote this code based on some of the learning I was able to paste together from tutorials. It is essentially placed in code to be loaded by the ModLoader to generate uranium ore blocks when a world is being generated.
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i=0; i < 30; i++){ //Obviously the higher the upper
//bound the more likely the block
int randPosX = chunkX + random.nextInt(16); //What exactly is being
//passed as chunkX? and chunkZ for that matter?
int randPosY = random.nextInt(128);
int randPosZ = chunkZ = random.nextInt(16);
(new WorldGenMinable(oreUranium.blockID, 16)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
Notch's explanation makes the positioning more clear, but I had some questions about how the chunks are formed. My understanding (intuition? not sure what I'm basing this on) is that the chunks are not all generated at world initialization, and most are generated on demand. Is this true? If so, how much of the world is produced at the beginning?
Another thing I'm wondering is if the above code snippet is overwriting blocks after they are generated? I'd imagine this is the case as it is modifying what must be the per-existing world generation code?