public void BeginWrite(INBTTag tagIn) { write(this._bWrite, tagIn); }
private void write(BinaryWriter bWrite, INBTTag tag) { WritePayload(bWrite, tag.Type, TagNodeType.TAG_BYTE); if (tag.Type != TagNodeType.TAG_END) WritePayload(bWrite, tag.Name, TagNodeType.TAG_STRING); if (tag is TagNode) { WritePayload(bWrite, tag.Payload, tag.Type); } else if (tag is TagNodeList) { WritePayload(bWrite, ((TagNodeList)tag).ChildType, TagNodeType.TAG_BYTE); WritePayload(bWrite, ((TagNodeList)tag).Count, TagNodeType.TAG_INT); foreach (INBTTag node in (TagNodeList)tag) { WritePayload(bWrite, node.Payload, node.Type); } } else if (tag is TagNodeListNamed) { foreach (INBTTag node in ((TagNodeListNamed)tag).Values) { if (node.Type != TagNodeType.TAG_END) write(bWrite, node); } bWrite.Write(0); } }
/// <summary> /// Gets all the chunk stored inside the region. /// </summary> /// <returns>Returns the chunks stored inside the chunk.</returns> public INBTTag[,] GetRegionChunks() { // create a 2D array that will store the chunks INBTTag[,] _chunks = new INBTTag[32, 32]; int i = 0; for (int x = 0; x < 32; x++) for (int z = 0; z < 32; z++) { // get the chunk location of the chunk with the specified coordinates _chunks[x, z] = GetChunkData(x, z); // debug information #if DEBUG if (_chunks[x, z].Name != "Empty chunk") Console.ForegroundColor = ConsoleColor.Green; else Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("{1}:\tChunk parse complete! {0}", _chunks[x, z].Name, ++i); #endif } #if DEBUG Console.ForegroundColor = ConsoleColor.White; #endif return _chunks; }