private void UpdatePosition() { NbtFile PlayerDat = new NbtFile(this.Server.ServerDirectory + "\\world\\players\\" + this.Username + ".dat"); PlayerDat.LoadFile(); this._position.x = PlayerDat.Query<LibNbt.Tags.NbtDouble>("//Pos/0").Value; this._position.y = PlayerDat.Query<LibNbt.Tags.NbtDouble>("//Pos/1").Value; this._position.z = PlayerDat.Query<LibNbt.Tags.NbtDouble>("//Pos/2").Value; PlayerDat.Dispose(); }
public override void Load(string Folder) { string f = Path.Combine(Folder, "DefaultMapGenerator.dat"); if (!File.Exists(f)) return; NbtFile nf = new NbtFile(f); nf.LoadFile(f); GenerateCaves = nf.Query<NbtByte>("/DefaultMapGenerator/GenerateCaves").Value == 0x01 ? true : false; GenerateDungeons = nf.Query<NbtByte>("/DefaultMapGenerator/GenerateDungeons").Value == 0x01 ? true : false; GenerateOres = nf.Query<NbtByte>("/DefaultMapGenerator/GenerateOres").Value == 0x01 ? true : false; GenerateWater = nf.Query<NbtByte>("/DefaultMapGenerator/GenerateWater").Value == 0x01 ? true : false; HellMode = nf.Query<NbtByte>("/DefaultMapGenerator/HellMode").Value == 0x01 ? true : false; GenerateTrees = nf.Query<NbtByte>("/DefaultMapGenerator/GenerateTrees").Value == 0x01 ? true : false; Frequency = nf.Query<NbtDouble>("/DefaultMapGenerator/Frequency").Value; NoiseQuality = (NoiseQuality) nf.Query<NbtByte>("/DefaultMapGenerator/NoiseQuality").Value; OctaveCount = nf.Query<NbtInt>("/DefaultMapGenerator/OctaveCount").Value; Lacunarity = nf.Query<NbtDouble>("/DefaultMapGenerator/Lacunarity").Value; Persistance = nf.Query<NbtDouble>("/DefaultMapGenerator/Persistance").Value; ContinentNoiseFrequency = nf.Query<NbtDouble>("/DefaultMapGenerator/ContinentNoiseFrequency").Value; CaveThreshold = nf.Query<NbtDouble>("/DefaultMapGenerator/CaveThreshold").Value; }
private void button8_Click_1(object sender, EventArgs e) { NbtFile PlayerDat = new NbtFile(YAMS.Core.RootFolder + "\\servers\\1\\world\\players\\bigolslabomeat.dat"); PlayerDat.LoadFile(); Vector _position; _position.x = PlayerDat.Query<LibNbt.Tags.NbtDouble>("//Pos/0").Value; _position.y = PlayerDat.Query<LibNbt.Tags.NbtDouble>("//Pos/1").Value; _position.z = PlayerDat.Query<LibNbt.Tags.NbtDouble>("//Pos/2").Value; PlayerDat.Dispose(); MessageBox.Show("x:" + _position.x.ToString() + " y:" + _position.y.ToString() + " z:" + _position.z.ToString()); }
public SlotData ReadSlotData() { var slotData = new SlotData(ReadInt16()); if (slotData.ItemID == -1) return null; slotData.ItemCount = ReadByte(); slotData.ItemDamage = ReadInt16(); var size = ReadInt16(); if (size == -1) return slotData; var file = new NbtFile(); file.LoadFile(_stream, true); var list = file.Query<NbtCompound>("").Query<NbtList>("ench"); slotData.ItemEnchantments = list; return slotData; }