private BlockEntity[] GetBlockEntities() { var level = _nbtDoc.Query <TagCompound>("Level"); return(level .GetList("TileEntities") //Was called TileEntities in earlier minecraft version. Official name is now BlockEntities .Value .Cast <TagCompound>() .Select(t => new BlockEntity(t)) .ToArray()); }
public void Query_returns_typed_tag() { // arrange var target = new NbtDocument(CreateComplexData()); var expected = (TagLong)((TagCompound)((TagList)target.DocumentRoot["listTest (compound)"]).Value[1])["created-on"]; // act var actual = target.Query <TagLong>(@"listTest (compound)\1\created-on"); // assert Assert.Same(expected, actual); }
public void Query_returns_tag() { // arrange NbtDocument target; Tag expected; Tag actual; target = new NbtDocument(this.CreateComplexData()); expected = ((TagCompound)((TagList)target.DocumentRoot["listTest (compound)"]).Value[1])["created-on"]; // act actual = target.Query(@"listTest (compound)\1\created-on"); // assert Assert.AreSame(expected, actual); }
public Column(ChunkFormat format, MemoryStream chunkDataStream, DateTime timestamp) { Modified = timestamp; var stream = GetDecompressedStream(format, chunkDataStream); //TODO: Need to dispose of this manually? _nbtDoc = NbtDocument.LoadDocument(stream); var level = _nbtDoc.Query <TagCompound>("Level"); XWorld = level.GetIntValue("xPos") * 16; ZWorld = level.GetIntValue("zPos") * 16; var terrainPopulated = level.GetByte("TerrainPopulated"); if (terrainPopulated != null) { TerrainPopulated = terrainPopulated.Value == 1; } else { TerrainPopulated = level.GetLongValue("LastUpdate") > 0; } }