public void Generate(IMapHandler mh, long X, long Y) { if (_Generator == null) return; string lockfile = Path.ChangeExtension(GetChunkFilename((int)X,(int)Y), "genlock"); if (!_Generator.NoPreservation) { if (File.Exists(lockfile)) return; } else { if (File.Exists(lockfile)) File.Delete(lockfile); } Chunk _c = mh.NewChunk(X, Y); byte[,,] b = _Generator.Generate(ref mh, X, Y); if (b == null) return; /* try { //Console.WriteLine("{0} blocks of stone post-generation.", GetBlockNumbers(b)[1]); } catch (Exception) { } */ _Generator.AddTrees(ref b, (int)X, (int)Y, (int)ChunkScale.Z); _c.Blocks = b; _c.UpdateOverview(); //_c.SkyLight=Utils.RecalcLighting(_c,true); //_c.BlockLight=Utils.RecalcLighting(_c,false); _c.Save(); File.WriteAllText(lockfile, ""); }