public static Chunk Load(NbtTree tag) { var dataVersion = tag.Root["DataVersion"].ToTagInt().Data; var level = tag.Root["Level"].ToTagCompound(); var sectionsList = level["Sections"].ToTagList(); if (sectionsList.Count == 0) { return(null); } var x = level["xPos"].ToTagInt().Data; var z = level["zPos"].ToTagInt().Data; var pos = new Coord2(x, z); var sections = sectionsList.Select(node => ChunkSection.Load(dataVersion, pos, node.ToTagCompound())).Where(section => section != null).ToArray(); var tiles = level["TileEntities"] .ToTagList() .Select(node => node.ToTagCompound()) .ToDictionary(node => new Coord3(node["x"].ToTagInt().Data, node["y"].ToTagInt().Data, node["z"].ToTagInt().Data), node => node); return(new Chunk(pos, sections, tiles)); }
protected bool Equals(ChunkSection other) { return(Pos.Equals(other.Pos) && Y == other.Y); }