コード例 #1
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public TileEntities(ListTag tag)
 {
     LoadFromTag(tag);
 }
コード例 #2
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
        public void LoadFromTag(ListTag tag)
        {
            TileEntityList = new List<TileEntity>();

            foreach (CompoundTag t in tag.Items)
            {
                TileEntityList.Add(new TileEntity(t));
            }
        }
コード例 #3
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public Rotation(ListTag tag)
 {
     LoadFromTag(tag);
 }
コード例 #4
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public void LoadFromTag(ListTag tag)
 {
     YawDegrees = tag.GetFloat(0);
     PitchDegrees = tag.GetFloat(1);
 }
コード例 #5
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public Pos(ListTag tag)
 {
     LoadFromTag(tag);
 }
コード例 #6
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public void LoadFromTag(ListTag tag)
 {
     X = tag.GetDouble(0);
     Y = tag.GetDouble(1);
     Z = tag.GetDouble(2);
 }
コード例 #7
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public Motion(ListTag tag)
 {
     LoadFromTag(tag);
 }
コード例 #8
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
 public void LoadFromTag(ListTag tag)
 {
     DX = tag.GetDouble(0);
     DY = tag.GetDouble(1);
     DZ = tag.GetDouble(2);
 }
コード例 #9
0
ファイル: Chunk.cs プロジェクト: andywhite37/NCraft
        public void LoadFromTag(ListTag tag)
        {
            EntityList = new List<Entity>();

            foreach (CompoundTag ct in tag.Items)
            {
                EntityList.Add(new Entity(ct));
            }
        }
コード例 #10
0
ファイル: NbtFileFixture.cs プロジェクト: andywhite37/NCraft
        private CompoundTag CreateBigTestNbtTag()
        {
            var tag = new CompoundTag()
            {
                Name = "Level",
            };

            var longTest = new LongTag()
            {
                Name = "longTest",
                Value = 9223372036854775807L,
            };
            tag.Items.Add(longTest);

            var shortTest = new ShortTag()
            {
                Name = "shortTest",
                Value = 32767,
            };
            tag.Items.Add(shortTest);

            var stringTest = new StringTag()
            {
                Name = "stringTest",
                Value = @"HELLO WORLD THIS IS A TEST STRING ÅÄÖ!",
            };
            tag.Items.Add(stringTest);

            var floatTest = new FloatTag()
            {
                Name = "floatTest",
                Value = 0.49823147F,
            };
            tag.Items.Add(floatTest);

            var intTest = new IntTag()
            {
                Name = "intTest",
                Value = 2147483647,
            };
            tag.Items.Add(intTest);

            var nestedCompoundTest = new CompoundTag()
            {
                Name = "nested compound test",
                Items = new List<Tag>()
                {
                    new CompoundTag()
                    {
                        Name = "ham",
                        Items = new List<Tag>()
                        {
                            new StringTag()
                            {
                                Name = "name",
                                Value = "Hampus",
                            },
                            new FloatTag()
                            {
                                Name = "value",
                                Value = 0.75F,
                            }
                        },
                    },
                    new CompoundTag()
                    {
                        Name = "egg",
                        Items = new List<Tag>()
                        {
                            new StringTag()
                            {
                                Name = "name",
                                Value = "Eggbert",
                            },
                            new FloatTag()
                            {
                                Name = "value",
                                Value = 0.5F,
                            }
                        },
                    }
                },
            };
            tag.Items.Add(nestedCompoundTest);

            var listTestLong = new ListTag()
            {
                Name = "listTest (long)",
                ItemType = TagType.Long,
                Length = 5,
                Items = new Tag[]
                {
                    new LongTag()
                    {
                        Value = 11,
                    },
                    new LongTag()
                    {
                        Value = 12,
                    },
                    new LongTag()
                    {
                        Value = 13,
                    },
                    new LongTag()
                    {
                        Value = 14,
                    },
                    new LongTag()
                    {
                        Value = 15,
                    },
                },
            };
            tag.Items.Add(listTestLong);

            var listTestCompound = new ListTag()
            {
                Name = "listTest (compound)",
                ItemType = TagType.Compound,
                Length = 2,
                Items = new Tag[]
                {
                    new CompoundTag()
                    {
                        Items = new List<Tag>()
                        {
                            new StringTag()
                            {
                                Name = "name",
                                Value = "Compound tag #0",
                            },
                            new LongTag()
                            {
                                Name = "created-on",
                                Value = 1264099775885L,
                            },
                        },
                    },
                    new CompoundTag()
                    {
                        Items = new List<Tag>()
                        {
                            new StringTag()
                            {
                                Name = "name",
                                Value = "Compound tag #1",
                            },
                            new LongTag()
                            {
                                Name = "created-on",
                                Value = 1264099775885L,
                            },
                        },
                    },
                },
            };
            tag.Items.Add(listTestCompound);

            var byteTest = new ByteTag()
            {
                Name = "byteTest",
                Value = 127,
            };
            tag.Items.Add(byteTest);

            var byteArrayTest = new ByteArrayTag()
            {
                Name = "byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...))",
                Length = 1000,
                Items = new byte[1000],
            };
            for (int i = 0; i < 1000; ++i)
            {
                byteArrayTest.Items[i] = (byte)((i * i * 255 + i * 7) % 100);
            }
            tag.Items.Add(byteArrayTest);

            var doubleTest = new DoubleTag()
            {
                Name = "doubleTest",
                Value = 0.4931287132182315,
            };
            tag.Items.Add(doubleTest);

            return tag;
        }
コード例 #11
0
ファイル: Level.cs プロジェクト: andywhite37/NCraft
 public void LoadFromTag(ListTag tag)
 {
     Items = tag.Items.Cast<CompoundTag>().Select(t => new InventoryItem(t)).ToList();
 }
コード例 #12
0
ファイル: Level.cs プロジェクト: andywhite37/NCraft
 public Inventory(ListTag tag)
 {
     LoadFromTag(tag);
 }
コード例 #13
0
ファイル: ListTagFixture.cs プロジェクト: andywhite37/NCraft
        public void ListTagTest()
        {
            var tag = new ListTag();

            Assert.AreEqual(TagType.List, tag.Type);
        }