public override void Run() { NbtWorld world = GetWorld(opt); IChunkManager cm = world.GetChunkManager(opt.OPT_DIM); FilteredChunkManager fcm = new FilteredChunkManager(cm, opt.GetChunkFilter()); int affectedChunks = 0; foreach (ChunkRef chunk in fcm) { if (chunk == null || !chunk.IsTerrainPopulated) { continue; } if (opt.OPT_V) { Console.WriteLine("Processing Chunk (" + chunk.X + "," + chunk.Z + ")"); } affectedChunks++; ApplyChunk(world, chunk); fcm.Save(); } Console.WriteLine("Affected Chunks: " + affectedChunks); }
public override void Run() { NbtWorld world = GetWorld(opt); IChunkManager cm = world.GetChunkManager(opt.OPT_DIM); FilteredChunkManager fcm = new FilteredChunkManager(cm, opt.GetChunkFilter()); StreamWriter fstr; try { fstr = new StreamWriter(opt._outFile, false); } catch (IOException e) { Console.WriteLine(e.Message); return; } fstr.WriteLine("["); bool first = true; foreach (ChunkRef chunk in fcm) { if (!first) { fstr.Write(","); } Chunk c = chunk.GetChunkRef(); if (!opt._dumpBlocks) { c.Tree.Root["Level"].ToTagCompound().Remove("Blocks"); c.Tree.Root["Level"].ToTagCompound().Remove("Data"); c.Tree.Root["Level"].ToTagCompound().Remove("BlockLight"); c.Tree.Root["Level"].ToTagCompound().Remove("SkyLight"); c.Tree.Root["Level"].ToTagCompound().Remove("HeightMap"); } if (!opt._dumpEntities) { c.Tree.Root["Level"].ToTagCompound().Remove("Entities"); } if (!opt._dumpTileEntities) { c.Tree.Root["Level"].ToTagCompound().Remove("TileEntities"); } string s = JSONSerializer.Serialize(c.Tree.Root["Level"], 1); fstr.Write(s); first = false; } fstr.WriteLine(); fstr.WriteLine("]"); fstr.Close(); }
public override void Run() { NbtWorld world = GetWorld(opt); IChunkManager cm = world.GetChunkManager(opt.OPT_DIM); FilteredChunkManager fcm = new FilteredChunkManager(cm, opt.GetChunkFilter()); int affectedChunks = 0; foreach (ChunkRef chunk in fcm) { affectedChunks++; fcm.DeleteChunk(chunk.X, chunk.Z); } Console.WriteLine("Purged Chunks: " + affectedChunks); }
public override void Run() { NbtWorld world = GetWorld(opt); IChunkManager cm = world.GetChunkManager(opt.OPT_DIM); FilteredChunkManager fcm = new FilteredChunkManager(cm, opt.GetChunkFilter()); int affectedChunks = 0; foreach (ChunkRef chunk in fcm) { if (opt.OPT_V) { Console.WriteLine("Processing chunk {0},{1}...", chunk.X, chunk.Z); } ApplyChunk(world, chunk); affectedChunks += fcm.Save() > 0 ? 1 : 0; } Console.WriteLine("Affected Chunks: " + affectedChunks); }
public override void Run() { if (!Directory.Exists(opt.OPT_WORLD) && !File.Exists(opt.OPT_WORLD)) { Console.WriteLine("Error: Could not locate path: " + opt.OPT_WORLD); return; } NbtWorld world = null; IChunkManager cm = null; FilteredChunkManager fcm = null; try { world = NbtWorld.Open(opt.OPT_WORLD); cm = world.GetChunkManager(opt.OPT_DIM); fcm = new FilteredChunkManager(cm, opt.GetChunkFilter()); } catch (Exception e) { Console.WriteLine("Error: Failed to open world: " + opt.OPT_WORLD); Console.WriteLine("Exception: " + e.Message); Console.WriteLine(e.StackTrace); return; } int affectedChunks = 0; foreach (ChunkRef chunk in fcm) { if (opt.OPT_V) { Console.WriteLine("Processing chunk {0},{1}...", chunk.X, chunk.Z); } ApplyChunk(world, chunk); affectedChunks += fcm.Save() > 0 ? 1 : 0; } Console.WriteLine("Affected Chunks: " + affectedChunks); }
public override void Run() { NbtWorld world = GetWorld(opt); IChunkManager cm = world.GetChunkManager(opt.OPT_DIM); FilteredChunkManager fcm = new FilteredChunkManager(cm, opt.GetChunkFilter()); if (opt.OPT_V) { Console.WriteLine("Clearing existing chunk lighting..."); } int affectedChunks = 0; foreach (ChunkRef chunk in fcm) { if (opt.OPT_VV) { Console.WriteLine("Resetting chunk {0},{1}...", chunk.X, chunk.Z); } if (opt.HeightMap) { chunk.Blocks.RebuildHeightMap(); } if (opt.BlockLight) { chunk.Blocks.ResetBlockLight(); } if (opt.SkyLight) { chunk.Blocks.ResetSkyLight(); } fcm.Save(); affectedChunks++; } if (opt.OPT_V) { Console.WriteLine("Rebuilding chunk lighting..."); } foreach (ChunkRef chunk in fcm) { if (opt.OPT_VV) { Console.WriteLine("Lighting chunk {0},{1}...", chunk.X, chunk.Z); } if (opt.BlockLight) { chunk.Blocks.RebuildBlockLight(); } if (opt.SkyLight) { chunk.Blocks.RebuildSkyLight(); } fcm.Save(); } if (opt.OPT_V) { Console.WriteLine("Reconciling chunk edges..."); } foreach (ChunkRef chunk in fcm) { if (opt.OPT_VV) { Console.WriteLine("Stitching chunk {0},{1}...", chunk.X, chunk.Z); } if (opt.BlockLight) { chunk.Blocks.StitchBlockLight(); } if (opt.SkyLight) { chunk.Blocks.StitchSkyLight(); } fcm.Save(); } Console.WriteLine("Relit Chunks: " + affectedChunks); }