예제 #1
0
파일: Column.cs 프로젝트: nojan1/Mineman
        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());
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
파일: Column.cs 프로젝트: nojan1/Mineman
        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;
            }
        }