Exemple #1
0
        /// <summary>
        /// Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.Add() never being called it thinks the list
        /// is always empty and will not remove any chunks.
        /// </summary>
        public virtual bool Unload100OldestChunks()
        {
            if (ChunkLoader != null)
            {
                ChunkLoader.ChunkTick();
            }

            return(ChunkProvider.Unload100OldestChunks());
        }
Exemple #2
0
        ///<summary>
        /// Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.Add() never being called it thinks the list
        /// is always empty and will not remove any chunks.
        ///</summary>
        public bool Unload100OldestChunks()
        {
            for (int i = 0; i < 100; i++)
            {
                if (droppedChunksSet.Count > 0)
                {
                    long  long1  = droppedChunksSet.GetEnumerator().Current;
                    Chunk chunk1 = (Chunk)chunkMap.GetValueByKey(long1);
                    chunk1.OnChunkUnload();
                    SaveChunkData(chunk1);
                    SaveChunkExtraData(chunk1);
                    droppedChunksSet.Remove(long1);
                    chunkMap.Remove(long1);
                    chunkList.Remove(chunk1);
                }
            }

            for (int j = 0; j < 10; j++)
            {
                if (field_35392_h >= chunkList.Count)
                {
                    field_35392_h = 0;
                    break;
                }

                Chunk        chunk        = chunkList[field_35392_h++];
                EntityPlayer entityplayer = worldObj.Func_48456_a((chunk.XPosition << 4) + 8, (chunk.ZPosition << 4) + 8, 288);

                if (entityplayer == null)
                {
                    DropChunk(chunk.XPosition, chunk.ZPosition);
                }
            }

            if (chunkLoader != null)
            {
                chunkLoader.ChunkTick();
            }

            return(chunkProvider.Unload100OldestChunks());
        }