So here's the code to cut off world generation after a certain number of chunks past spawn. Just as a reminder, this is under the net.minecraft.chunk package under the Chunk class. This is a rewrite of the populateChunk method:
public void populateChunk(IChunkProvider interface1, IChunkProvider interface2, int posX, int posY)
{
//Get the spawn coordinate
ChunkCoordinates spawn = worldObj.getSpawnPoint();
//These are the number of chunks to generate on each side of spawn chunk (if each is set to 0 you will get a world consisting of just the spawn chunk)
//Each world will have an odd number of chunks because it consists of the spawn chunk plus 2*worldChunksVariable
int worldXChunks = 1; //(*2+1)
int worldZChunks = 1; //(*2+1)
//this if statement says if the coordinate of the x chunk its checking is within the bounds of the spawn chunk +/- worldXChunks
//and if the z chunk is also within its bounds, continue with world generation
if(posX <= (spawn.posX/16)+worldXChunks && posX >= (spawn.posX/16)-worldXChunks && posY <= (spawn.posZ/16)+worldZChunks && posY >= (spawn.posZ/16)-worldZChunks) {
//Normal chunk generation
if (!this.isTerrainPopulated && interface1.chunkExists(posX + 1, posY + 1) && interface1.chunkExists(posX, posY + 1) && interface1.chunkExists(posX + 1, posY))
{
interface1.populate(interface2, posX, posY);
}
if (interface1.chunkExists(posX - 1, posY) && !interface1.provideChunk(posX - 1, posY).isTerrainPopulated && interface1.chunkExists(posX - 1, posY + 1) && interface1.chunkExists(posX, posY + 1) && interface1.chunkExists(posX - 1, posY + 1))
{
interface1.populate(interface2, posX - 1, posY);
}
if (interface1.chunkExists(posX, posY - 1) && !interface1.provideChunk(posX, posY - 1).isTerrainPopulated && interface1.chunkExists(posX + 1, posY - 1) && interface1.chunkExists(posX + 1, posY - 1) && interface1.chunkExists(posX + 1, posY))
{
interface1.populate(interface2, posX, posY - 1);
}
if (interface1.chunkExists(posX - 1, posY - 1) && !interface1.provideChunk(posX - 1, posY - 1).isTerrainPopulated && interface1.chunkExists(posX, posY - 1) && interface1.chunkExists(posX - 1, posY))
{
interface1.populate(interface2, posX - 1, posY - 1);
}
}
}
Now this code is not perfect. It seems as though somewhere else in the code the world wants to keep attempting to generate chunks past the limit and as such causes the player to glitch out when in the area where a chunk would be. If I have time between work and school this week I'll work on sorting that out so that the area around the chunk limit isn't glitchy and the player can just jump off the world and fall into the void.