Пример #1
0
    // Builds Structure data in non-indexed Chunks
    private void SavePregenChunk()
    {
        cacheChunk = Structure.reloadChunks[0];
        regionHandler.GetCorrectRegion(cacheChunk.pos);

        // If it's loaded
        if (chunks.ContainsKey(cacheChunk.pos))
        {
            cacheChunk.needsGeneration = 0;

            // Rough Application of Structures
            Structure.RoughApply(chunks[cacheChunk.pos], cacheChunk);
            chunks[cacheChunk.pos] = cacheChunk;

            this.regionHandler.SaveChunk(cacheChunk);

            if (!toDraw.Contains(cacheChunk.pos))
            {
                toDraw.Add(cacheChunk.pos);
            }
        }

        // If is in an unloaded indexed chunk
        else if (this.regionHandler.IsIndexed(cacheChunk.pos))
        {
            Chunk c = new Chunk(cacheChunk.pos, this.rend, this.blockBook, this, fromMemory: true);
            this.regionHandler.LoadChunk(c);

            // Rough Application of Structures
            Structure.RoughApply(c, cacheChunk);

            this.regionHandler.SaveChunk(c);
        }

        // If is in an unloaded unknown chunk
        else
        {
            this.regionHandler.SaveChunk(cacheChunk);
        }


        Structure.reloadChunks.RemoveAt(0);
    }
Пример #2
0
    // Builds Structure data in non-indexed Chunks
    private void SavePregenChunk()
    {
        cacheChunk = Structure.reloadChunks[0];
        regionHandler.GetCorrectRegion(cacheChunk.pos);

        // If it's loaded
        if (chunks.ContainsKey(cacheChunk.pos))
        {
            cacheChunk.needsGeneration = 0;

            // Rough Application of Structures
            Structure.RoughApply(chunks[cacheChunk.pos], cacheChunk);

            this.regionHandler.SaveChunk(chunks[cacheChunk.pos]);

            SendChunkToRequestingClients(cacheChunk.pos);
        }

        // If is in an unloaded indexed chunk
        else if (this.regionHandler.IsIndexed(cacheChunk.pos))
        {
            Chunk c = new Chunk(cacheChunk.pos, server: true);
            this.regionHandler.LoadChunk(c);

            // Rough Application of Structures
            Structure.RoughApply(c, cacheChunk);

            this.regionHandler.SaveChunk(c);
        }

        // If is in an unloaded unknown chunk
        else
        {
            this.regionHandler.SaveChunk(cacheChunk);
        }


        Structure.reloadChunks.RemoveAt(0);
    }