/// <summary> /// loads or generates the chunk at the chunk location specified /// </summary> public virtual Chunk LoadChunk(int par1, int par2) { Chunk chunk = new Chunk(WorldObj, par1, par2); ChunkMapping.Add(ChunkCoordIntPair.ChunkXZ2Int(par1, par2), chunk); chunk.IsChunkLoaded = true; return(chunk); }
/// <summary> /// Returns a biome cache block at location specified. /// </summary> public virtual BiomeCacheBlock GetBiomeCacheBlock(int par1, int par2) { par1 >>= 4; par2 >>= 4; long l = (long)par1 & 0xffffffffL | ((long)par2 & 0xffffffffL) << 32; BiomeCacheBlock biomecacheblock = (BiomeCacheBlock)CacheMap.GetValueByKey(l); if (biomecacheblock == null) { biomecacheblock = new BiomeCacheBlock(this, par1, par2); CacheMap.Add(l, biomecacheblock); Cache.Add(biomecacheblock); } biomecacheblock.LastAccessTime = JavaHelper.CurrentTimeMillis(); return(biomecacheblock); }
///<summary> /// loads or generates the chunk at the chunk location specified ///</summary> public Chunk LoadChunk(int par1, int par2) { long l = ChunkCoordIntPair.ChunkXZ2Int(par1, par2); droppedChunksSet.Remove(l); Chunk chunk = (Chunk)chunkMap.GetValueByKey(l); if (chunk == null) { int i = 0x1c9c3c; if (par1 < -i || par2 < -i || par1 >= i || par2 >= i) { return(emptyChunk); } chunk = LoadChunkFromFile(par1, par2); if (chunk == null) { if (chunkProvider == null) { chunk = emptyChunk; } else { chunk = chunkProvider.ProvideChunk(par1, par2); } } chunkMap.Add(l, chunk); chunkList.Add(chunk); if (chunk != null) { chunk.Func_4143_d(); chunk.OnChunkLoad(); } chunk.PopulateChunk(this, this, par1, par2); } return(chunk); }