Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
    private void Start()
    {
        instance = this;

        TagNodeCompound levelDat    = NBTHelper.GetLevelDat();
        TagNodeLong     dayTimeNode = levelDat["DayTime"] as TagNodeLong;
        int             dayTime     = (int)dayTimeNode.Data;

        tick = dayTime;
    }
Ejemplo n.º 3
0
        public virtual TagNode BuildTree()
        {
            TagNodeCompound tree = new TagNodeCompound();

            tree["map"] = new TagNodeLong(_mapId);

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

            return(tree);
        }
Ejemplo n.º 4
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);
        }
 public TagLongDataNode(TagNodeLong tag)
     : base(tag)
 {
 }
Ejemplo n.º 6
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);
        }