예제 #1
0
        private IChunk loadChunk(int planetId, Index3 index)
        {
            IUniverse universe = GetUniverse(0);
            IPlanet   planet   = GetPlanet(planetId);

            // Load from disk
            IChunk first = chunkPersistence.Load(universe.Id, planetId, index);

            if (first != null)
            {
                return(first);
            }

            IChunk[] result = mapGenerator.GenerateChunk(DefinitionManager.GetBlockDefinitions(), planet, new Index2(index.X, index.Y));
            if (result != null && result.Length > index.Z && index.Z >= 0)
            {
                result[index.Z].ChangeCounter = 0;
                return(result[index.Z]);
            }

            return(null);
        }