Пример #1
0
        static void Main(string[] args)
        {
            string dest = "F:\\Minecraft\\test";
            int    xmin = -20;
            int    xmax = 20;
            int    zmin = -20;
            int    zmaz = 20;

            // This will instantly create any necessary directory structure
            BetaWorld        world = BetaWorld.Create(dest);
            BetaChunkManager cm    = world.GetChunkManager();

            // We can set different world parameters
            world.Level.LevelName = "Flatlands";
            world.Level.Spawn     = new SpawnPoint(20, 20, 70);

            // world.Level.SetDefaultPlayer();
            // We'll let MC create the player for us, but you could use the above
            // line to create the SSP player entry in level.dat.

            // We'll create chunks at chunk coordinates xmin,zmin to xmax,zmax
            for (int xi = xmin; xi < xmax; xi++)
            {
                for (int zi = zmin; zi < zmaz; zi++)
                {
                    // This line will create a default empty chunk, and create a
                    // backing region file if necessary (which will immediately be
                    // written to disk)
                    ChunkRef chunk = cm.CreateChunk(xi, zi);

                    // This will suppress generating caves, ores, and all those
                    // other goodies.
                    chunk.IsTerrainPopulated = true;

                    // Auto light recalculation is horrifically bad for creating
                    // chunks from scratch, because we're placing thousands
                    // of blocks.  Turn it off.
                    chunk.Blocks.AutoLight = false;

                    // Set the blocks
                    FlatChunk(chunk, 64);

                    // Reset and rebuild the lighting for the entire chunk at once
                    chunk.Blocks.RebuildBlockLight();
                    chunk.Blocks.RebuildSkyLight();

                    Console.WriteLine("Built Chunk {0},{1}", chunk.X, chunk.Z);

                    // Save the chunk to disk so it doesn't hang around in RAM
                    cm.Save();
                }
            }

            // Save all remaining data (including a default level.dat)
            // If we didn't save chunks earlier, they would be saved here
            world.Save();
        }
Пример #2
0
 public static void CreateInitialChunks(BetaChunkManager cm, frmMace frmLogForm, string strUndergroundOres)
 {
     int[, ,] intUndergroundTerrain = MakeUndergroundTerrain(64, frmLogForm, strUndergroundOres);
     for (int xi = 0; xi < City.MapLength / 16; xi++)
     {
         for (int zi = -City.FarmLength / 16; zi < City.MapLength / 16; zi++)
         {
             ChunkRef chunkActive = cm.CreateChunk(xi, zi);
             chunkActive.IsTerrainPopulated = true;
             chunkActive.Blocks.AutoLight   = false;
             CreateFlatChunk(chunkActive, intUndergroundTerrain);
             cm.Save();
         }
         frmLogForm.UpdateProgress(((1 + xi) * 24 / (City.MapLength / 16)) / 100);
     }
     cm.Save();
 }
Пример #3
0
 public static void CreateInitialChunks(BetaChunkManager cm, int intEnd, frmMace frmLogForm)
 {
     int[, ,] intUndergroundTerrain = MakeUndergroundTerrain(intEnd * 16, 64, intEnd * 16);
     for (int xi = 0; xi < intEnd; xi++)
     {
         for (int zi = 0; zi < intEnd; zi++)
         {
             ChunkRef chunkActive = cm.CreateChunk(xi, zi);
             chunkActive.IsTerrainPopulated = true;
             chunkActive.Blocks.AutoLight = false;
             CreateFlatChunk(chunkActive, intUndergroundTerrain);
             cm.Save();
         }
         frmLogForm.UpdateProgress((1 + xi) * 24 / intEnd);
     }
     cm.Save();
 }
Пример #4
0
 public static void CreateInitialChunks(BetaChunkManager cm, int intEnd, frmMace frmLogForm)
 {
     int[, ,] intUndergroundTerrain = MakeUndergroundTerrain(intEnd * 16, 64, intEnd * 16);
     for (int xi = 0; xi < intEnd; xi++)
     {
         for (int zi = 0; zi < intEnd; zi++)
         {
             ChunkRef chunkActive = cm.CreateChunk(xi, zi);
             chunkActive.IsTerrainPopulated = true;
             chunkActive.Blocks.AutoLight   = false;
             CreateFlatChunk(chunkActive, intUndergroundTerrain);
             cm.Save();
         }
         frmLogForm.UpdateProgress((1 + xi) * 24 / intEnd);
     }
     cm.Save();
 }