Exemple #1
0
        private Chunk Func_542_c(int par1, int par2)
        {
            if (ChunkLoader == null)
            {
                return(BlankChunk);
            }

            try
            {
                Chunk chunk = ChunkLoader.LoadChunk(WorldObj, par1, par2);

                if (chunk != null)
                {
                    chunk.LastSaveTime = WorldObj.GetWorldTime();
                }

                return(chunk);
            }
            catch (Exception exception)
            {
                Utilities.LogException(exception);
            }

            return(BlankChunk);
        }
Exemple #2
0
 public void LoadBlocks(IChunkLoader loader)
 {
     _world.RWLock.AcquireWriterLock(System.Threading.Timeout.Infinite);
     loader.LoadChunk(_key, _data);
     _world.RWLock.ReleaseWriterLock();
     _world.ChunkModified(this);
 }
Exemple #3
0
        ///<summary>
        /// Attemps to load the chunk from the save file, returns null if the chunk is not available.
        ///</summary>
        private Chunk LoadChunkFromFile(int par1, int par2)
        {
            if (chunkLoader == null)
            {
                return(null);
            }

            try
            {
                Chunk chunk = chunkLoader.LoadChunk(worldObj, par1, par2);

                if (chunk != null)
                {
                    chunk.LastSaveTime = worldObj.GetWorldTime();
                }

                return(chunk);
            }
            catch (Exception exception)
            {
                Utilities.LogException(exception);
            }

            return(null);
        }
        public void GetChunk(int x, int y)
        {
            CacheKey key = GetKey(x, y);

            Chunk stored = _cache[key];

            if (stored == null)
            {
                stored = _chunkLoader.LoadChunk(x, y);
            }

            OnChunkUpdate(stored);
        }
Exemple #5
0
        private bool TryLoadChunk(Vector2i position, string chunkFilePath, out Chunk chunk)
        {
            chunk = _chunkLoader.LoadChunk(chunkFilePath);
            if (chunk != null)
            {
                _logger.Debug("Retrieved chunk for planet {@Id} at {@X} {@Y} from loader", chunk.PlanetId, position.X, position.Y);
                chunk.LastLoadTime = DateTime.Now;
                _chunks.Add(position, chunk);
                {
                    return(true);
                }
            }

            return(false);
        }