/// <inheritdoc/> public TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); tree["id"] = new TagNodeString(_id); tree["Count"] = new TagNodeByte(_count); tree["Damage"] = new TagNodeShort(_damage); if (_enchantments.Count > 0) { TagNodeList enchList = new TagNodeList(TagType.TAG_COMPOUND); foreach (Enchantment e in _enchantments) { enchList.Add(e.BuildTree()); } TagNodeCompound tagtree = new TagNodeCompound(); tagtree["ench"] = enchList; if (_source != null && _source.ContainsKey("tag")) { tagtree.MergeFrom(_source["tag"].ToTagCompound()); } tree["tag"] = tagtree; } if (_source != null) { tree.MergeFrom(_source); } return(tree); }
public virtual TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); tree["map"] = new TagNodeLong(_mapId); if (_source != null) { tree.MergeFrom(_source); } return(tree); }
/// <inheritdoc /> public TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); tree["id"] = new TagNodeShort(_id); tree["lvl"] = new TagNodeShort(_level); if (_source != null) { tree.MergeFrom(_source); } return(tree); }
/// <summary> /// Builds a Tile Entity subtree from the current data. /// </summary> /// <returns>The root node of a Tile Entity subtree representing the current data.</returns> public virtual TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); tree["id"] = new TagNodeString(_id); tree["x"] = new TagNodeInt(_x); tree["y"] = new TagNodeInt(_y); tree["z"] = new TagNodeInt(_z); if (_source != null) { tree.MergeFrom(_source); } return(tree); }
/// <summary> /// Builds a <see cref="TileTick"/> subtree from the current data. /// </summary> /// <returns>The root node of a <see cref="TileTick"/> subtree representing the current data.</returns> public TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); tree["i"] = new TagNodeInt(_blockId); tree["t"] = new TagNodeInt(_ticks); tree["x"] = new TagNodeInt(_x); tree["y"] = new TagNodeInt(_y); tree["z"] = new TagNodeInt(_z); if (_source != null) { tree.MergeFrom(_source); } return(tree); }
/// <summary> /// Builds a Map subtree from the current data. /// </summary> /// <returns>The root node of a Map subtree representing the current data.</returns> public virtual TagNode BuildTree() { TagNodeCompound data = new TagNodeCompound(); data["scale"] = new TagNodeByte(_scale); data["dimension"] = new TagNodeByte(_dimension); data["height"] = new TagNodeShort(_height); data["width"] = new TagNodeShort(_width); data["xCenter"] = new TagNodeInt(_x); data["zCenter"] = new TagNodeInt(_z); data["colors"] = new TagNodeByteArray(_colors); if (_source != null) { data.MergeFrom(_source); } TagNodeCompound tree = new TagNodeCompound(); tree.Add("data", data); return(tree); }
/// <summary> /// Builds an Entity subtree from the current data. /// </summary> /// <returns>The root node of an Entity subtree representing the current data.</returns> public TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); TagNodeList pos = new TagNodeList(TagType.TAG_DOUBLE); pos.Add(new TagNodeDouble(_pos.X)); pos.Add(new TagNodeDouble(_pos.Y)); pos.Add(new TagNodeDouble(_pos.Z)); tree["Pos"] = pos; TagNodeList motion = new TagNodeList(TagType.TAG_DOUBLE); motion.Add(new TagNodeDouble(_motion.X)); motion.Add(new TagNodeDouble(_motion.Y)); motion.Add(new TagNodeDouble(_motion.Z)); tree["Motion"] = motion; TagNodeList rotation = new TagNodeList(TagType.TAG_FLOAT); rotation.Add(new TagNodeFloat((float)_rotation.Yaw)); rotation.Add(new TagNodeFloat((float)_rotation.Pitch)); tree["Rotation"] = rotation; tree["FallDistance"] = new TagNodeFloat(_fallDistance); tree["Fire"] = new TagNodeShort(_fire); tree["Air"] = new TagNodeShort(_air); tree["OnGround"] = new TagNodeByte(_onGround); if (_source != null) { tree.MergeFrom(_source); } return(tree); }
/// <summary> /// Builds a Level subtree from the current data. /// </summary> /// <returns>The root node of a Level subtree representing the current data.</returns> public virtual TagNode BuildTree() { TagNodeCompound data = new TagNodeCompound(); data["Time"] = new TagNodeLong(_time); data["LastPlayed"] = new TagNodeLong(_lastPlayed); if (_player != null) { data["Player"] = _player.BuildTree(); } data["SpawnX"] = new TagNodeInt(_spawnX); data["SpawnY"] = new TagNodeInt(_spawnY); data["SpawnZ"] = new TagNodeInt(_spawnZ); data["SizeOnDisk"] = new TagNodeLong(_sizeOnDisk); data["RandomSeed"] = new TagNodeLong(_randomSeed); if (_version != null && _version != 0) { data["version"] = new TagNodeInt(_version ?? 0); } if (_name != null) { data["LevelName"] = new TagNodeString(_name); } if (_generator != null) { data["generatorName"] = new TagNodeString(_generator); } if (_raining != null) { data["raining"] = new TagNodeByte(_raining ?? 0); } if (_thundering != null) { data["thundering"] = new TagNodeByte(_thundering ?? 0); } if (_rainTime != null) { data["rainTime"] = new TagNodeInt(_rainTime ?? 0); } if (_thunderTime != null) { data["thunderTime"] = new TagNodeInt(_thunderTime ?? 0); } if (_gameType != null) { data["GameType"] = new TagNodeInt(_gameType ?? 0); } if (_mapFeatures != null) { data["MapFeatures"] = new TagNodeByte(_mapFeatures ?? 0); } if (_hardcore != null) { data["hardcore"] = new TagNodeByte(_hardcore ?? 0); } if (_generatorOptions != null) { data["generatorOptions"] = new TagNodeString(_generatorOptions); } if (_generatorVersion != null) { data["generatorVersion"] = new TagNodeInt(_generatorVersion ?? 0); } if (_allowCommands != null) { data["allowCommands"] = new TagNodeByte(_allowCommands ?? 0); } if (_initialized != null) { data["initialized"] = new TagNodeByte(_initialized ?? 0); } if (_DayTime != null) { data["DayTime"] = new TagNodeLong(_DayTime ?? 0); } TagNodeCompound gr = new TagNodeCompound(); gr["commandBlockOutput"] = new TagNodeString(_gameRules.CommandBlockOutput ? "true" : "false"); gr["doFireTick"] = new TagNodeString(_gameRules.DoFireTick ? "true" : "false"); gr["doMobLoot"] = new TagNodeString(_gameRules.DoMobLoot ? "true" : "false"); gr["doMobSpawning"] = new TagNodeString(_gameRules.DoMobSpawning ? "true" : "false"); gr["doTileDrops"] = new TagNodeString(_gameRules.DoTileDrops ? "true" : "false"); gr["keepInventory"] = new TagNodeString(_gameRules.KeepInventory ? "true" : "false"); gr["mobGriefing"] = new TagNodeString(_gameRules.MobGriefing ? "true" : "false"); data["GameRules"] = gr; if (_source != null) { data.MergeFrom(_source); } TagNodeCompound tree = new TagNodeCompound(); tree.Add("Data", data); return(tree); }
/// <summary> /// Builds a Level subtree from the current data. /// </summary> /// <returns>The root node of a Level subtree representing the current data.</returns> public virtual TagNode BuildTree() { TagNodeCompound data = new TagNodeCompound(); data["Time"] = new TagNodeLong(_time); data["LastPlayed"] = new TagNodeLong(_lastPlayed); if (_player != null) { data["Player"] = _player.BuildTree(); } data["SpawnX"] = new TagNodeInt(_spawnX); data["SpawnY"] = new TagNodeInt(_spawnY); data["SpawnZ"] = new TagNodeInt(_spawnZ); data["SizeOnDisk"] = new TagNodeLong(_sizeOnDisk); data["RandomSeed"] = new TagNodeLong(_randomSeed); if (_version != null && _version != 0) { data["version"] = new TagNodeInt(_version ?? 0); } if (_name != null) { data["LevelName"] = new TagNodeString(_name); } if (_raining != null) { data["raining"] = new TagNodeByte(_raining ?? 0); } if (_thundering != null) { data["thundering"] = new TagNodeByte(_thundering ?? 0); } if (_rainTime != null) { data["rainTime"] = new TagNodeInt(_rainTime ?? 0); } if (_thunderTime != null) { data["thunderTime"] = new TagNodeInt(_thunderTime ?? 0); } if (_gameType != null) { data["GameType"] = new TagNodeInt(_gameType ?? 0); } if (_mapFeatures != null) { data["MapFeatures"] = new TagNodeByte(_mapFeatures ?? 0); } if (_hardcore != null) { data["hardcore"] = new TagNodeByte(_hardcore ?? 0); } if (_source != null) { data.MergeFrom(_source); } TagNodeCompound tree = new TagNodeCompound(); tree.Add("Data", data); return(tree); }
/// <inheritdoc/> public TagNode BuildTree() { TagNodeCompound tree = new TagNodeCompound(); tree["id"] = new TagNodeShort(_id); tree["Count"] = new TagNodeByte(_count); tree["Damage"] = new TagNodeShort(_damage); TagNodeCompound tagtree = new TagNodeCompound(); if (_enchantments.Count > 0) { TagNodeList enchList = new TagNodeList(TagType.TAG_COMPOUND); foreach (Enchantment e in _enchantments) { enchList.Add(e.BuildTree()); } tagtree["ench"] = enchList; if (_source != null && _source.ContainsKey("tag")) { tagtree.MergeFrom(_source["tag"].ToTagCompound()); } } if (_storedEnchantments.Count > 0) { TagNodeList storedEnchList = new TagNodeList(TagType.TAG_COMPOUND); foreach (Enchantment e in _storedEnchantments) { storedEnchList.Add(e.BuildTree()); } tagtree["StoredEnchantments"] = storedEnchList; if (_source != null && _source.ContainsKey("tag")) { tagtree.MergeFrom(_source["tag"].ToTagCompound()); } } if (_name != null || _lore != null || _color != 0) { TagNodeCompound displayTag = new TagNodeCompound(); if (_color != 0) { displayTag.Add("color", new TagNodeInt(_color)); } if (_name != null) { displayTag.Add("Name", new TagNodeString(_name)); } if (_lore != null) { List <TagNode> LoreList = new List <TagNode>(); string[] lores = _lore.Split('\n'); foreach (string lore in lores) { LoreList.Add(new TagNodeString(lore)); } displayTag.Add("Lore", new TagNodeList(TagType.TAG_STRING, LoreList)); } tagtree["display"] = displayTag; } if (tagtree.Count > 0) { tree["tag"] = tagtree; } if (_source != null) { tree.MergeFrom(_source); } return(tree); }