Пример #1
0
        /// <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);
            }

            TagNodeCompound tree = new TagNodeCompound();

            tree.Add("Data", data);

            return(tree);
        }
Пример #2
0
        /// <summary>
        /// Builds a Player subtree from the current data.
        /// </summary>
        /// <returns>The root node of a Player subtree representing the current data.</returns>
        public virtual new TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["AttackTime"] = new TagNodeShort(_attackTime);
            tree["DeathTime"]  = new TagNodeShort(_deathTime);
            tree["Health"]     = new TagNodeShort(_health);
            tree["HurtTime"]   = new TagNodeShort(_hurtTime);

            tree["Dimension"]  = new TagNodeInt(_dimension);
            tree["Sleeping"]   = new TagNodeByte(_sleeping);
            tree["SleepTimer"] = new TagNodeShort(_sleepTimer);

            if (_spawnX != null && _spawnY != null && _spawnZ != null)
            {
                tree["SpawnX"] = new TagNodeInt(_spawnX ?? 0);
                tree["SpawnY"] = new TagNodeInt(_spawnY ?? 0);
                tree["SpawnZ"] = new TagNodeInt(_spawnZ ?? 0);
            }

            if (_world != null)
            {
                tree["World"] = new TagNodeString(_world);
            }

            tree["Inventory"] = _inventory.BuildTree();

            return(tree);
        }
Пример #3
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["EntityId"] = new TagNodeString(_entityID);
            tree["Delay"]    = new TagNodeShort(_delay);

            if (_maxDelay != null)
            {
                tree["MaxSpawnDelay"] = new TagNodeShort(_maxDelay ?? 0);
            }
            if (_minDelay != null)
            {
                tree["MinSpawnDelay"] = new TagNodeShort(_minDelay ?? 0);
            }
            if (_spawnCount != null)
            {
                tree["SpawnCount"] = new TagNodeShort(_spawnCount ?? 0);
            }
            if (_spawnRange != null)
            {
                tree["SpawnRange"] = new TagNodeShort(_spawnRange ?? 0);
            }
            if (_maxNearbyEnemies != null)
            {
                tree["MaxNearbyEnemies"] = new TagNodeShort(_maxNearbyEnemies ?? 0);
            }
            if (_requiredPlayerRange != null)
            {
                tree["RequiredPlayerRange"] = new TagNodeShort(_requiredPlayerRange ?? 0);
            }
            if (_maxExperience != null)
            {
                tree["MaxExperience"] = new TagNodeInt(_maxExperience ?? 0);
            }
            if (_remainingExperience != null)
            {
                tree["RemainingExperience"] = new TagNodeInt(_remainingExperience ?? 0);
            }
            if (_experienceRegenTick != null)
            {
                tree["ExperienceRegenTick"] = new TagNodeInt(_experienceRegenTick ?? 0);
            }
            if (_experienceRegenRate != null)
            {
                tree["ExperienceRegenRate"] = new TagNodeInt(_experienceRegenRate ?? 0);
            }
            if (_experienceRegenAmount != null)
            {
                tree["ExperienceRegenAmount"] = new TagNodeInt(_experienceRegenAmount ?? 0);
            }

            if (_spawnData != null && _spawnData.Count > 0)
            {
                tree["SpawnData"] = _spawnData;
            }

            return(tree);
        }
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["Type"] = new TagNodeInt((int)_type);

            return(tree);
        }
Пример #5
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["Profession"] = new TagNodeInt(_profession);

            return(tree);
        }
Пример #6
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["Size"] = new TagNodeInt(_size);

            return(tree);
        }
Пример #7
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["Age"]    = new TagNodeInt(_age);
            tree["InLove"] = new TagNodeInt(_inLove);

            return(tree);
        }
Пример #8
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["AttackTime"]          = new TagNodeShort(_attackTime);
            tree["DeathTime"]           = new TagNodeShort(_deathTime);
            tree["Health"]              = new TagNodeShort(_health);
            tree["HurtTime"]            = new TagNodeShort(_hurtTime);
            tree["CanPickUpLoot"]       = new TagNodeByte(_canPickUpLoot);
            tree["PersistenceRequired"] = new TagNodeByte(_persistenceRequired);
            tree["CustomName"]          = new TagNodeString(_customName);
            tree["CustomNameVisible"]   = new TagNodeByte(_customNameVisible);

            if (_activeEffects != null)
            {
                TagNodeList effects = new TagNodeList(TagType.TAG_COMPOUND);
                foreach (ActiveEffects effect in _activeEffects)
                {
                    if (!effect.IsValid)
                    {
                        continue;
                    }
                    TagNodeCompound ae = new TagNodeCompound();
                    ae["Id"]        = new TagNodeByte((byte)effect.Id);
                    ae["Amplifier"] = new TagNodeByte((byte)effect.Amplifier);
                    ae["Duration"]  = new TagNodeInt(effect.Duration);
                    ae["Ambient"]   = new TagNodeByte(effect.Ambient ? (byte)1 : (byte)0);
                    effects.Add(ae);
                }

                tree["ActiveEffects"] = effects;
            }
            if (_equipment != null)
            {
                TagNodeList equipment = new TagNodeList(TagType.TAG_COMPOUND);
                foreach (Item item in _equipment)
                {
                    equipment.Add(item.BuildTree());
                }

                tree["Equipment"] = equipment;
            }
            if (_dropChances != null)
            {
                TagNodeList dropChances = new TagNodeList(TagType.TAG_FLOAT);

                foreach (float dc in _dropChances)
                {
                    dropChances.Add(new TagNodeFloat(dc));
                }

                tree["DropChances"] = dropChances;
            }

            return(tree);
        }
Пример #9
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["Levels"]    = new TagNodeInt(_levels);
            tree["Primary"]   = new TagNodeInt(_primary);
            tree["Secondary"] = new TagNodeInt(_secondary);

            return(tree);
        }
Пример #10
0
        /// <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);

            return(tree);
        }
Пример #11
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            if (_record != null)
            {
                tree["Record"] = new TagNodeInt((int)_record);
            }

            return(tree);
        }
Пример #12
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["Dir"]    = new TagNodeByte((byte)_dir);
            tree["Motive"] = new TagNodeString(_motive);
            tree["TileX"]  = new TagNodeInt(_xTile);
            tree["TileY"]  = new TagNodeInt(_yTile);
            tree["TileZ"]  = new TagNodeInt(_zTile);

            return(tree);
        }
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            if (_record != null)
            {
                tree["blockId"]   = new TagNodeInt(_blockId);
                tree["blockData"] = new TagNodeInt(_blockData);
                tree["facing"]    = new TagNodeInt(_facing);
                tree["progress"]  = new TagNodeFloat(_progress);
                tree["extending"] = new TagNodeByte(_extending);
            }

            return(tree);
        }
Пример #14
0
        /// <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);
        }
Пример #15
0
        /// <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);
        }
Пример #16
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["AttackTime"] = new TagNodeShort(_attackTime);
            tree["DeathTime"]  = new TagNodeShort(_deathTime);
            tree["Health"]     = new TagNodeShort(_health);
            tree["HurtTime"]   = new TagNodeShort(_hurtTime);

            if (_activeEffects != null)
            {
                TagNodeCompound ae = new TagNodeCompound();
                ae["Id"]        = new TagNodeByte((byte)_activeEffects.Id);
                ae["Amplifier"] = new TagNodeByte((byte)_activeEffects.Amplifier);
                ae["Duration"]  = new TagNodeInt(_activeEffects.Duration);

                tree["ActiveEffects"] = ae;
            }

            return(tree);
        }
Пример #17
0
        public override TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            if (CustomName != null)
            {
                tree["CustomName"] = new TagNodeString(CustomName);
            }
            tree["Base"] = new TagNodeInt((int)BaseColor);
            if (Patterns.Length != 0)
            {
                tree["Patterns"] = new TagNodeList(
                    TagType.TAG_COMPOUND,
                    Patterns.Select(x => new TagNodeCompound()
                {
                    { "Color", new TagNodeInt((int)x.Color) },
                    { "Pattern", new TagNodeString(x.Pattern) }
                }).ToList <TagNode>()
                    );
            }

            return(tree);
        }
Пример #18
0
        /// <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);
        }
Пример #19
0
        /// <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);
        }
Пример #20
0
        /// <summary>
        /// Builds a Player subtree from the current data.
        /// </summary>
        /// <returns>The root node of a Player subtree representing the current data.</returns>
        public virtual new TagNode BuildTree()
        {
            TagNodeCompound tree = base.BuildTree() as TagNodeCompound;

            tree["AttackTime"] = new TagNodeShort(_attackTime);
            tree["DeathTime"]  = new TagNodeShort(_deathTime);
            tree["Health"]     = new TagNodeShort(_health);
            tree["HurtTime"]   = new TagNodeShort(_hurtTime);

            tree["Dimension"]  = new TagNodeInt(_dimension);
            tree["Sleeping"]   = new TagNodeByte(_sleeping);
            tree["SleepTimer"] = new TagNodeShort(_sleepTimer);

            if (_spawnX != null && _spawnY != null && _spawnZ != null)
            {
                tree["SpawnX"] = new TagNodeInt(_spawnX ?? 0);
                tree["SpawnY"] = new TagNodeInt(_spawnY ?? 0);
                tree["SpawnZ"] = new TagNodeInt(_spawnZ ?? 0);
            }
            else
            {
                tree.Remove("SpawnX");
                tree.Remove("SpawnY");
                tree.Remove("SpawnZ");
            }

            if (_world != null)
            {
                tree["World"] = new TagNodeString(_world);
            }

            if (_foodLevel != null)
            {
                tree["foodLevel"] = new TagNodeInt(_foodLevel ?? 0);
            }
            if (_foodTickTimer != null)
            {
                tree["foodTickTimer"] = new TagNodeInt(_foodTickTimer ?? 0);
            }
            if (_foodExhaustion != null)
            {
                tree["foodExhaustionLevel"] = new TagNodeFloat(_foodExhaustion ?? 0);
            }
            if (_foodSaturation != null)
            {
                tree["foodSaturation"] = new TagNodeFloat(_foodSaturation ?? 0);
            }
            if (_xpP != null)
            {
                tree["XpP"] = new TagNodeFloat(_xpP ?? 0);
            }
            if (_xpLevel != null)
            {
                tree["XpLevel"] = new TagNodeInt(_xpLevel ?? 0);
            }
            if (_xpTotal != null)
            {
                tree["XpTotal"] = new TagNodeInt(_xpTotal ?? 0);
            }
            if (_score != null)
            {
                tree["Score"] = new TagNodeInt(_score ?? 0);
            }

            if (_gameType != null)
            {
                tree["PlayerGameType"] = new TagNodeInt((int)(_gameType ?? PlayerGameType.Survival));
            }

            if (AbilitiesSet())
            {
                TagNodeCompound pb = new TagNodeCompound();
                pb["flying"]       = new TagNodeByte(_abilities.Flying ? (byte)1 : (byte)0);
                pb["instabuild"]   = new TagNodeByte(_abilities.InstantBuild ? (byte)1 : (byte)0);
                pb["mayfly"]       = new TagNodeByte(_abilities.MayFly ? (byte)1 : (byte)0);
                pb["invulnerable"] = new TagNodeByte(_abilities.Invulnerable ? (byte)1 : (byte)0);
                pb["mayBuild"]     = new TagNodeByte(_abilities.MayBuild ? (byte)1 : (byte)0);
                pb["walkSpeed"]    = new TagNodeFloat(_abilities.WalkSpeed);
                pb["flySpeed"]     = new TagNodeFloat(_abilities.FlySpeed);

                tree["abilities"] = pb;
            }

            tree["Inventory"]  = _inventory.BuildTree();
            tree["EnderItems"] = _enderItems.BuildTree();

            return(tree);
        }
Пример #21
0
        /// <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 (_generatorName != null)
            {
                data["generatorName"] = new TagNodeString(_generatorName);
            }
            if (_generatorOptions != null)
            {
                data["generatorOptions"] = new TagNodeString(_generatorOptions.GetGeneratorOptions());
            }
            else
            {
                data["generatorOptions"] = new TagNodeString("");
            }
            if (_difficulty != null)
            {
                data["Difficulty"] = new TagNodeByte(_difficulty ?? 0);
            }
            if (_difficultyLocked != null)
            {
                data["DifficultyLocked"] = new TagNodeByte(_difficultyLocked ?? 0);
            }
            if (_allowCommands != null)
            {
                data["allowCommands"] = new TagNodeByte(_allowCommands ?? 0);
            }


            if (_source != null)
            {
                data.MergeFrom(_source);
            }

            TagNodeCompound tree = new TagNodeCompound();

            tree.Add("Data", data);

            return(tree);
        }
Пример #22
0
 public TagIntDataNode(TagNodeInt tag)
     : base(tag)
 {
 }