public static void CropMaceWorld(frmMace frmLogForm) { // thank you to Surrogard <*****@*****.**> for providing a linux friendly version of this code: Directory.CreateDirectory("macecopy".ToMinecraftSaveDirectory()); AnvilWorld awCopy = AnvilWorld.Create("macecopy".ToMinecraftSaveDirectory()); RegionChunkManager cmCopy = awCopy.GetChunkManager(); AnvilWorld awCrop = AnvilWorld.Open("mace".ToMinecraftSaveDirectory()); RegionChunkManager cmCrop = awCrop.GetChunkManager(); foreach (ChunkRef chunk in cmCrop) { if (chunk.X >= -7 && chunk.X <= 11 && chunk.Z >= 0 && chunk.Z <= 11) { Debug.WriteLine("Copying chunk " + chunk.X + "," + chunk.Z); cmCopy.SetChunk(chunk.X, chunk.Z, chunk.GetChunkRef()); } cmCopy.Save(); } awCopy.Level.GameType = GameType.CREATIVE; cmCopy.Save(); awCopy.Save(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { Process.Start("explorer.exe", @"/select," + "macecopy".ToMinecraftSaveDirectory() + "\\level.dat"); } }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("You must specify a target directory"); return; } string dest = args[0]; AnvilWorld world = AnvilWorld.Open("F:\\Minecraft\\test"); BlockManager bm = world.GetBlockManager(); bm.AutoLight = false; Grid grid = new Grid(); grid.BuildInit(bm); Generator gen = new Generator(); List <Generator.Edge> edges = gen.Generate(); foreach (Generator.Edge e in edges) { int x1; int y1; int z1; gen.UnIndex(e.node1, out x1, out y1, out z1); int x2; int y2; int z2; gen.UnIndex(e.node2, out x2, out y2, out z2); grid.LinkRooms(bm, x1, y1, z1, x2, y2, z2); } // Entrance Room grid.BuildRoom(bm, 2, 5, 2); grid.LinkRooms(bm, 2, 5, 2, 1, 5, 2); grid.LinkRooms(bm, 2, 5, 2, 3, 5, 2); grid.LinkRooms(bm, 2, 5, 2, 2, 5, 1); grid.LinkRooms(bm, 2, 5, 2, 2, 5, 3); grid.LinkRooms(bm, 2, 4, 2, 2, 5, 2); // Exit Room grid.BuildRoom(bm, 2, -1, 2); grid.LinkRooms(bm, 2, -1, 2, 2, 0, 2); grid.AddPrize(bm, 2, -1, 2); Console.WriteLine("Relight Chunks"); RegionChunkManager cm = world.GetChunkManager(); cm.RelightDirtyChunks(); world.Save(); }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("You must specify a target directory"); return; } string dest = args[0]; /* * NbtVerifier.InvalidTagType += (e) => { * throw new Exception("Invalid Tag Type: " + e.TagName + " [" + e.Tag + "]"); * }; * NbtVerifier.InvalidTagValue += (e) => { * throw new Exception("Invalid Tag Value: " + e.TagName + " [" + e.Tag + "]"); * }; * NbtVerifier.MissingTag += (e) => { * throw new Exception("Missing Tag: " + e.TagName); * }; */ // Opening an NbtWorld will try to autodetect if a world is Alpha-style or Beta-style Console.WriteLine("AnvilWorld.Open(dest)"); AnvilWorld world = AnvilWorld.Open(dest); // Grab a generic chunk manager reference Console.WriteLine("world.GetChunkManager()"); IChunkManager cm = world.GetChunkManager(); // Iterate through all the chunks foreach (ChunkRef chunk in cm) { // Check if Ocean chunk bool foundocean = false; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { if (chunk.Biomes.GetBiome(x, z) == BiomeType.Ocean || chunk.Biomes.GetBiome(x, z) == BiomeType.DeepOcean || chunk.Biomes.GetBiome(x, z) == BiomeType.FrozenOcean) { foundocean = true; } } } // Or if old unpopulated chunk //set status as liquid_carved (or similar) if (foundocean == true) { Console.WriteLine("Found ocean in chunk {0},{1}, setting status to liquid_carved", chunk.X, chunk.Z); chunk.Status = "liquid_carved"; } cm.Save(); //Console.WriteLine("Repopulated Chunk {0},{1}", chunk.X, chunk.Z); } }
public static void openFile(Form plcType, Form main, ComboBox height, ToolStripProgressBar mLoad, ToolStripStatusLabel mStatus) { bool noFile = true, cancel = false; OpenFileDialog openDiag; DialogResult res; String filename; mnuHeight = height; mnuLoad = mLoad; mnuStatus = mStatus; init = true; plcType.Hide(); while (noFile ^ cancel) { openDiag = new OpenFileDialog(); openDiag.Multiselect = false; openDiag.AddExtension = true; openDiag.DefaultExt = "dat"; openDiag.Filter = "Minecraft Levels (*.dat)|*.dat|" + "All Files (*.*)|*.*"; res = openDiag.ShowDialog(); plcType.Show(); if (res == DialogResult.Cancel) { cancel = true; } else { filename = openDiag.FileName; noFile = false; openDiag.Dispose(); lvl = AnvilWorld.Open(filename); if (lvl == null) { MessageBox.Show("That file was not a compatible Minecraft level.", "Open File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { regDiag = new SelectRegion(lvl.GetRegionManager(), main); loadLimits(); selectRegion(true); } } } }
static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: BlockReplace <world> <jsonFile>"); return; } StreamReader streamReader = new StreamReader(args [1]); string json = streamReader.ReadToEnd(); streamReader.Close(); JObject o = JObject.Parse(json); IList <int> elevations = o.SelectToken("elevation-flat").Select(s => (int)s).ToList(); Console.WriteLine("Load Elevations..."); string dest = args [0]; AnvilWorld world = AnvilWorld.Open(dest); BlockManager bm = world.GetBlockManager(); bm.AutoLight = true; // Set Elevations int i = 0; while (i < elevations.Count) { if (i % 100 == 0) { //RegionChunkManager cm = world.GetChunkManager(); //cm.RelightDirtyChunks(); } int el = elevations[i]; int x = i / 1001 | 0; int y = i % 1001; x = 1001 - x; // Symetry x -= 500; y -= 500; bm.SetID(x, el, y, (int)BlockType.GRASS); if (el > 1) { bm.SetID(x, el - 1, y, (int)BlockType.DIRT); } if (el > 2) { bm.SetID(x, el - 2, y, (int)BlockType.DIRT); } if (el > 3) { bm.SetID(x, el - 3, y, (int)BlockType.DIRT); } if (el > 4) { bm.SetID(x, el - 4, y, (int)BlockType.DIRT); } ++i; } Console.WriteLine("Load Mods..."); IList <int> mods = o.SelectToken("mods").Select(s => (int)s).ToList(); Console.WriteLine(mods.Count); i = 0; while (i < mods.Count - 4) { int x = (int)mods [i++]; int y = (int)mods [i++]; int z = (int)mods [i++]; int t = (int)mods [i++]; if (t > 126) { Console.WriteLine("Failed"); Console.WriteLine(t); Console.WriteLine(x); Console.WriteLine(y); Console.WriteLine(z); continue; } x = 1001 - x; // Symetry x -= 500; y -= 500; // Check if valid block if (t < 256 && z > 0 && z <= 255) { bm.SetID(x, z, y, t); } } Console.WriteLine("over generation"); world.Save(); }
public int HandleCli(string[] Args) { _Configuration = new RenderConfiguration(_ColourPalette, _Metrics); // *** Function returns TRUE if the command line is invalid and the program should NOT proceed. if (HandleCommandLineArguments(Args)) { return(0); } // *** World path is mandatory. if (_Configuration.WorldPath == "") { Console.WriteLine("A world must be specified."); ShowHelp(); return(0); } // *** Load the world Console.WriteLine("Opening world file:"); Console.WriteLine(" " + _Configuration.WorldPath + "..."); AnvilWorld World; // *** Try and open the world. If it fails, handle it gracefully try { World = AnvilWorld.Open(_Configuration.WorldPath); } catch (Exception Ex) { Console.WriteLine("World could not be opened for reading:"); Console.WriteLine(Ex.ToString()); Console.WriteLine("Please check that the world exists and is valid."); return(0); } // *** Read world and compute metrics (size, chunk count, more?) Console.WriteLine("Determining world boundaries"); _StepTimer.Reset(); _StepTimer.Start(); _Metrics.Measure(World.GetChunkManager(_Configuration.Dimension)); _StepTimer.Stop(); Console.WriteLine("Took " + _StepTimer.Elapsed.ToString("m\\ms\\sff")); Console.WriteLine("Boundaries: (" + _Metrics.MinX.ToString() + ", " + _Metrics.MinZ.ToString() + ") to (" + _Metrics.MaxX.ToString() + ", " + _Metrics.MaxZ.ToString() + ")"); // *** Render dimension, if applicable if (_Configuration.SaveFilename != "") { _StepTimer.Reset(); _StepTimer.Start(); // *** Load palettes. Start with palettes in EXE directory, then append all palettes in the force-load list. Console.WriteLine("Loading Palettes..."); // ReSharper disable once AssignNullToNotNullAttribute // *** It's probably safe to assume our EXE is gonna be in a folder. foreach (String PalFile in Directory.EnumerateFiles(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "*.pal").Concat(_LoadAdditionalPalettes)) { string PaletteFile = PalFile; if (!PaletteFile.EndsWith(".pal") && !File.Exists(PaletteFile)) //Append ".pal" to filename if it's been accidentally omitted { PaletteFile += ".pal"; } if (File.Exists(PaletteFile)) { try { _ColourPalette.LoadPalette(PaletteFile); } catch (BlockPalette.PaletteExecutionException Ex) { Console.WriteLine(Ex.Message); } catch (Exception Ex) { Console.WriteLine("Failed to load palette " + Path.GetFileNameWithoutExtension(PaletteFile) + ":"); if (Ex is BlockPalette.PaletteExecutionException) { Console.WriteLine(Ex.Message); } else { Console.WriteLine("Internal Error"); } } } else { Console.WriteLine("Skipped missing file " + PaletteFile); } } _ColourPalette.AssembleLookupTables(); Console.WriteLine("Palettes loaded. Took " + _StepTimer.Elapsed.ToString("m\\ms\\sff")); _StepTimer.Reset(); _StepTimer.Start(); _Renderer = new StandardRenderer(); // *** Set up the progress indicator Console.WriteLine("Using " + (_Configuration.EnableMultithreading ? "multi-threaded" : "single-threaded") + " " + _Renderer.RendererFriendlyName); _Renderer.ProgressUpdate += OnRenderProgressUpdate; _Renderer.RenderError += OnRenderError; _Configuration.Chunks = World.GetChunkManager(_Metrics.Dimension); if (!_Configuration.RenderSubregion) { _Configuration.SubregionChunks = new Rectangle(_Metrics.MinX, _Metrics.MinZ, (_Metrics.MaxX - _Metrics.MinX), (_Metrics.MaxZ - _Metrics.MinZ)); } _Renderer.Configure(_Configuration); _Renderer.Initialize(); if (!_Renderer.IsAborting) { _Renderer.Render(); } _StepTimer.Stop(); if (_Renderer.IsAborting) { Console.WriteLine("\r\nMap export failed."); } else { Console.WriteLine("\r\nMap export complete. Took " + _StepTimer.Elapsed.ToString("m\\ms\\sff")); } } // *** Produce sign information file, if applicable if (_Configuration.ScanFilename != "") { _StepTimer.Reset(); _StepTimer.Start(); SignExporter Exporter = new SignExporter(); Exporter.Process(World.GetChunkManager(_Metrics.Dimension), _Metrics, _Configuration.ScanFilename); _StepTimer.Stop(); Console.WriteLine("Took " + _StepTimer.Elapsed.ToString("m\\ms\\sff")); } // *** Write world metrics, if applicable if (_Configuration.MetricsFilename != "") { WriteMetricsFile(World); } #if DEBUG System.Threading.Thread.Sleep(5500); // *** If debug mode, pause at the end to give me time to read any messages #endif return(0); }
private void ExecuteOpenWorld(object Sender, EventArgs E) { DialogResult Result = fbOpenFolder.ShowDialog(); // *** Open world, or at least try if (Result != DialogResult.OK) { return; } ToggleControls(false, false, false); _World = null; try { _World = AnvilWorld.Open(fbOpenFolder.SelectedPath); // *** Load Dimension list Regex ValidDimNames = new Regex(@"(?<Path>(?:DIM[^\-\d]*)?(?<Name>-?\d{1,}|region))$"); cbDimension.Items.Clear(); cbDimension.BeginUpdate(); int UseIndex = -1; foreach (String S in Directory.GetDirectories(_World.Path)) { Match Match = ValidDimNames.Match(S); if (!Match.Success) { continue; } DimensionListEntry Entry = new DimensionListEntry("Dimension " + Match.Groups["Name"].Value, Match.Groups["Path"].Value); if (Match.Groups["Name"].Value == "region") { Entry.Name = "Overworld"; Entry.Value = ""; UseIndex = cbDimension.Items.Count; } else if (Match.Groups["Name"].Value == "-1") { Entry.Name = "The Nether"; } else if (Match.Groups["Name"].Value == "1") { Entry.Name = "The End"; } else if (Match.Groups["Path"].Value.Contains("_MYST")) { Entry.Name = "Mystcraft " + Entry.Name; } cbDimension.Items.Add(Entry); } cbDimension.SelectedIndex = UseIndex; cbDimension.EndUpdate(); SetStatus(String.Format("Loaded {0}", _World.Level.LevelName)); ToggleControls(false, true, false); return; } catch (FileNotFoundException) { MessageBox.Show(string.Format("The folder {0} does not appear to contain a valid Minecraft world", fbOpenFolder.SelectedPath), "Error Loading World", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } #if !DEBUG catch (Exception Ex) { MessageBox.Show(string.Format("Error - Could not load world:\r\n{1}\r\n({0})", Ex.Message, Ex.GetType().Name), "Error Loading World", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endif SetStatus("World load failed"); }
private static void GenerateScrf(GenerateOptions opts) { var world = AnvilWorld.Open(opts.WorldPath); var donorWorld = AnvilWorld.Open(opts.OriginalPath); var dim = opts.WorldDim; var manager = world.GetChunkManager(dim).ToList(); var donorManager = donorWorld.GetChunkManager(dim); var inputMap = NbtMap.Load(Path.Combine(opts.OriginalPath, "cdfidmap.nbt")); var outputMap = NbtMap.Load(Path.Combine(opts.WorldPath, "cdfidmap.nbt")); var chunkBounds = new ChunkBounds(opts.ChunkBounds); if (!chunkBounds.BoundsExist) { Console.WriteLine("Input bounds not in the correct format"); return; } var diff = new ScarifStructure(outputMap); Console.Clear(); var cgui = new ConsoleGui(); var pbChunks = new ConsoleGuiProgressBar(0, 0, Console.WindowWidth, 0, 1) { ForegroundColor = ConsoleColor.Green, BackgroundColor = ConsoleColor.DarkGray }; var lChunksTotal = new ConsoleGuiLabel(0, 1, "Total Chunks : {0}"); var lChunksRemaining = new ConsoleGuiLabel(0, 2, "Remaining Chunks: {0}"); var lStatus = new ConsoleGuiLabel(0, 3, "Status : {0}"); var lChunksProcessed = new ConsoleGuiLabel(Console.WindowWidth / 2, 1, "Processed Chunks : {0}"); var lChunksSkipped = new ConsoleGuiLabel(Console.WindowWidth / 2, 2, "Skipped Chunks : {0}"); var lChunksDiffed = new ConsoleGuiLabel(Console.WindowWidth / 2, 3, "Diffed Chunks : {0}"); var lBlocksDiffed = new ConsoleGuiLabel(Console.WindowWidth / 2, 4, "Diffed Blocks : {0}"); var lTilesDiffed = new ConsoleGuiLabel(Console.WindowWidth / 2, 5, "Diffed TEs : {0}"); cgui.Add(pbChunks); cgui.Add(lChunksTotal); cgui.Add(lChunksRemaining); cgui.Add(lStatus); cgui.Add(lChunksProcessed); cgui.Add(lChunksSkipped); cgui.Add(lChunksDiffed); cgui.Add(lBlocksDiffed); cgui.Add(lTilesDiffed); var processedChunks = 0; var diffedChunks = 0; var diffedBlocks = 0; var diffedTiles = 0; var skipped = 0; lStatus.Value = "Processing..."; for (var i = 1; i <= manager.Count; i++) { var chunk = manager[i - 1]; if (i > 1) { manager[i - 2] = null; } pbChunks.Value = (float)i / manager.Count; if (!donorManager.ChunkExists(chunk.X, chunk.Z) || !chunkBounds.CoarseContains(chunk)) { skipped++; continue; } processedChunks++; var pos = new ChunkPosition(chunk.X, chunk.Z); var otherChunk = donorManager.GetChunk(chunk.X, chunk.Z); var numBlocksBefore = diffedBlocks; for (var y = 0; y < 256; y++) { for (var x = 0; x < 16; x++) { for (var z = 0; z < 16; z++) { if (!chunkBounds.Contains(chunk.X * 16 + x, y, chunk.Z * 16 + z)) { continue; } var blockId = (short)chunk.Blocks.GetID(x, y, z); var blockData = chunk.Blocks.GetData(x, y, z); NbtTree nbt = null; var te = chunk.Blocks.GetTileEntity(x, y, z); if (te != null) { nbt = new NbtTree(te.Source, "tile"); } var blockIdOriginal = (short)otherChunk.Blocks.GetID(x, y, z); var blockDataOriginal = otherChunk.Blocks.GetData(x, y, z); NbtTree nbtOriginal = null; var teOriginal = otherChunk.Blocks.GetTileEntity(x, y, z); if (teOriginal != null) { nbtOriginal = new NbtTree(teOriginal.Source, "tile"); } if (!inputMap.ContainsKey(blockIdOriginal) || !outputMap.ContainsKey(blockId)) { continue; } if (inputMap[blockIdOriginal] == outputMap[blockId] && blockDataOriginal == blockData && nbtOriginal == nbt) { continue; } if (nbtOriginal != nbt) { diffedTiles++; } diffedBlocks++; diff.Add(pos, new BlockPosition(x, y, z), new ScarifBlock(blockId, blockData, nbt)); } } } if (diffedBlocks != numBlocksBefore) { diffedChunks++; } lChunksTotal.Value = i.ToString("N0"); lChunksRemaining.Value = (manager.Count - i).ToString("N0"); lChunksProcessed.Value = processedChunks.ToString("N0"); lBlocksDiffed.Value = diffedBlocks.ToString("N0"); lTilesDiffed.Value = diffedTiles.ToString("N0"); lChunksDiffed.Value = diffedChunks.ToString("N0"); lChunksSkipped.Value = skipped.ToString("N0"); cgui.Render(); } lStatus.Value = "Saving..."; cgui.Render(); diff.Save(opts.DiffOutput); lStatus.Value = "Done. Press Enter."; cgui.Render(); Console.ReadKey(); }
public World ConvertWorld(String mcDirectory) { String segmentDirectory = Path.Combine(FCEDirectory, "Segments"); if (!Directory.Exists(FCEDirectory)) { Directory.CreateDirectory(FCEDirectory); } if (!Directory.Exists(Path.Combine(FCEDirectory, segmentDirectory))) { Directory.CreateDirectory(segmentDirectory); } Boolean anvil = true; NbtWorld nbtWorld = AnvilWorld.Open(mcDirectory); String worldName = nbtWorld.Level.LevelName; IChunkManager chunkManager = nbtWorld.GetChunkManager(); try { // Try to test for mc world type // Don't know how this is supposed to work, but it presumably throws an exception // on a non-Anvil world. chunkManager.Count(); } catch { anvil = false; nbtWorld = BetaWorld.Open(mcDirectory); worldName = nbtWorld.Level.LevelName; chunkManager = nbtWorld.GetChunkManager(); } Int32 spawnChunkX = nbtWorld.Level.Spawn.X >> 4; Int32 spawnChunkZ = nbtWorld.Level.Spawn.Z >> 4; WorldSettings settings = new WorldSettings(); settings.Name = worldName; var fceWorld = World.Create(FCEDirectory, settings); var segmentManager = fceWorld.SegmentManager; _totalSegments = chunkManager.LongCount() * (anvil ? 16 : 8); _segmentsLeft = _totalSegments; StartSaveThread(fceWorld); foreach (ChunkRef chunk in chunkManager) { // If the save thread is too slow, wait until it has caught up before adding to it to prevent high ram usage while (_saveQueue.Count > 5000) { Thread.Sleep(500); } if (chunk.Blocks == null) { _segmentsLeft -= (anvil ? 16 : 8); continue; } Int32 spawnOffsetX = UseSpawnAsOrigin ? spawnChunkX - chunk.X : -chunk.X; Int32 spawnOffsetZ = UseSpawnAsOrigin ? spawnChunkZ - chunk.Z : -chunk.Z; // Minecraft has different x/y directions so we must reverse z so the world isn't mirrored var chunkCoords = new SegmentCoords(spawnOffsetX, 0, -spawnOffsetZ) + SegmentCoords.WorldCenter; for (Int32 i = 0; i < (anvil ? 16 : 8); i++) { SegmentCoords segCoords = chunkCoords + SegmentCoords.Above * i; var segment = new Segment(segmentManager, segCoords); var array = new Cube[16, 16, 16]; for (Byte x = 0; x < 16; x++) { for (Byte y = 0; y < 16; y++) { for (Byte z = 0; z < 16; z++) { // Minecraft has different x/y directions so we must reverse z so the world isn't mirrored AlphaBlock block = chunk.Blocks.GetBlock(15 - z, y + i * 16, x); UInt32 mcIdData = (UInt32)block.ID << 16 | (UInt16)block.Data; Cube cube; if (!_mcIdDataToFCECube.TryGetValue(mcIdData, out cube)) { cube = new Cube(1, 0, 0, 0); if (!UnknownBlocks.ContainsKey((UInt16)block.ID)) { UnknownBlocks.Add((UInt16)block.ID, block.Info.Name); } } array[z, y, x] = cube; } } } segment.CubeData = array; _segmentsLeft--; _saveQueue.Enqueue(segment); } // Pad the area above the converted world with 11 blank segments to prevent world gen from occuring // Possibly replace this in the future with simply shifting the world up for (Int32 i = (anvil ? 16 : 8); i < 27; i++) { var padding = new Segment(segmentManager, chunkCoords + SegmentCoords.Above * i); padding.CubeData = Segment.GetBlankSegment().CubeData; padding.IsEmpty = true; _saveQueue.Enqueue(padding); } } Task.WaitAll(_saveTask); return(fceWorld); }
void GenerateList() { StreamWriter wr = new StreamWriter(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "HiveList.txt"), false); int totalcount = 0; int ore = 2646; int oreMeta = 6; int hive = 627; // Open our world AnvilWorld world = AnvilWorld.Open(worldPath); // The chunk manager is more efficient than the block manager for // this purpose, since we'll inspect every block RegionChunkManager rcm = world.GetChunkManager(0); pbChunks.Maximum = rcm.Count(); pbChunks.Minimum = 0; pbChunks.Value = 0; foreach (ChunkRef chunk in rcm) { pbChunks.Value++; //if (chunk.X < 0 || chunk.Z < 0 || chunk.Z > 134 || chunk.X > 111) //{ // continue; //} // You could hardcode your dimensions, but maybe some day they // won't always be 16. Also the CLR is a bit stupid and has // trouble optimizing repeated calls to Chunk.Blocks.xx, so we // cache them in locals int xdim = chunk.Blocks.XDim; int ydim = chunk.Blocks.YDim; int zdim = chunk.Blocks.ZDim; AnvilBiomeCollection chunkBiome = chunk.Biomes; // x, z, y is the most efficient order to scan blocks (not that // you should care about internal detail) for (int x = 0; x < xdim; x++) { for (int z = 0; z < zdim; z++) { int biome = chunkBiome.GetBiome(x, z); for (int y = 0; y < ydim; y++) { int cid = chunk.Blocks.GetID(x, y, z); if (y > 1) { if (cid == hive) { int cdata = chunk.Blocks.GetData(x, y, z); //if (cdata == oreMeta) //{ wr.WriteLine("H;{0};{1};{2};{3},{4}", chunk.X * xdim + x, chunk.Z * zdim + z, y, biome, cdata); totalcount++; //} } } //Break when hitting daylight. int light = chunk.Blocks.GetSkyLight(x, y, z); if (light == 12) { break; } } } } if (pbChunks.Value % 32 == 0) { txtDebug.Text = string.Format("Processed Chunk {0},{1}", chunk.X, chunk.Z) + Environment.NewLine; Application.DoEvents(); } } txtDebug.Text += string.Format("Found ore count:{0}", totalcount) + Environment.NewLine; wr.Close(); }