/**
* Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
* specified chunk from the map seed and chunk seed
*/
public Chunk provideChunk(int par1, int par2) {
Chunk chunk = new Chunk(this.worldObj, par1, par2);
for (int k = 0; k < this.cachedBlockIDs.length; ++k) {
int l = k >> 4;
ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l];
if (extendedblockstorage == null) {
extendedblockstorage = new ExtendedBlockStorage(k, !this.worldObj.provider.hasNoSky);
chunk.getBlockStorageArray()[l] = extendedblockstorage;
}
for (int i1 = 0; i1 < 16; ++i1) {
for (int j1 = 0; j1 < 16; ++j1) {
extendedblockstorage.func_150818_a(i1, k & 15, j1, Block.getBlockById(this.cachedBlockIDs[k] & 255));
extendedblockstorage.setExtBlockMetadata(i1, k & 15, j1, this.cachedBlockMetadata[k]);
}
}
}
chunk.generateSkylightMap();
BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(null, par1 * 16, par2 * 16, 16, 16);
byte[] abyte = chunk.getBiomeArray();
for (int k1 = 0; k1 < abyte.length; ++k1) {
abyte[k1] = (byte) abiomegenbase[k1].biomeID;
}
chunk.generateSkylightMap();
return chunk;
}