/// <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> /// Removes BiomeCacheBlocks from this cache that haven't been accessed in at least 30 seconds. /// </summary> public virtual void CleanupCache() { long l = JavaHelper.CurrentTimeMillis(); long l1 = l - LastCleanupTime; if (l1 > 7500L || l1 < 0L) { LastCleanupTime = l; for (int i = 0; i < Cache.Count; i++) { BiomeCacheBlock biomecacheblock = (BiomeCacheBlock)Cache[i]; long l2 = l - biomecacheblock.LastAccessTime; if (l2 > 30000L || l2 < 0L) { Cache.RemoveAt(i--); long l3 = (long)biomecacheblock.XPosition & 0xffffffffL | ((long)biomecacheblock.ZPosition & 0xffffffffL) << 32; CacheMap.Remove(l3); } } } }