Esempio n. 1
0
        private void UpdateTagCompound(NBTTagCompound par1NBTTagCompound, NBTTagCompound par2NBTTagCompound)
        {
            par1NBTTagCompound.SetLong("RandomSeed", RandomSeed);
            par1NBTTagCompound.SetString("generatorName", TerrainType.Func_48628_a());
            par1NBTTagCompound.SetInteger("generatorVersion", TerrainType.GetGeneratorVersion());
            par1NBTTagCompound.SetInteger("GameType", GameType);
            par1NBTTagCompound.Setbool("MapFeatures", MapFeaturesEnabled);
            par1NBTTagCompound.SetInteger("SpawnX", SpawnX);
            par1NBTTagCompound.SetInteger("SpawnY", SpawnY);
            par1NBTTagCompound.SetInteger("SpawnZ", SpawnZ);
            par1NBTTagCompound.SetLong("Time", WorldTime);
            par1NBTTagCompound.SetLong("SizeOnDisk", SizeOnDisk);
            par1NBTTagCompound.SetLong("LastPlayed", JavaHelper.CurrentTimeMillis());
            par1NBTTagCompound.SetString("LevelName", LevelName);
            par1NBTTagCompound.SetInteger("version", SaveVersion);
            par1NBTTagCompound.SetInteger("rainTime", RainTime);
            par1NBTTagCompound.Setbool("raining", Raining);
            par1NBTTagCompound.SetInteger("thunderTime", ThunderTime);
            par1NBTTagCompound.Setbool("thundering", Thundering);
            par1NBTTagCompound.Setbool("hardcore", Hardcore);

            if (par2NBTTagCompound != null)
            {
                par1NBTTagCompound.SetCompoundTag("Player", par2NBTTagCompound);
            }
        }
 /// <summary>
 /// Writes a tile entity to NBT.
 /// </summary>
 public override void WriteToNBT(NBTTagCompound par1NBTTagCompound)
 {
     base.WriteToNBT(par1NBTTagCompound);
     par1NBTTagCompound.SetString("Text1", SignText[0]);
     par1NBTTagCompound.SetString("Text2", SignText[1]);
     par1NBTTagCompound.SetString("Text3", SignText[2]);
     par1NBTTagCompound.SetString("Text4", SignText[3]);
 }
        /// <summary>
        /// (abstract) Protected helper method to write subclass entity data to NBT.
        /// </summary>
        public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
        {
            base.WriteEntityToNBT(par1NBTTagCompound);

            if (GetOwnerName() == null)
            {
                par1NBTTagCompound.SetString("Owner", "");
            }
            else
            {
                par1NBTTagCompound.SetString("Owner", GetOwnerName());
            }

            par1NBTTagCompound.Setbool("Sitting", IsSitting());
        }
Esempio n. 4
0
        /// <summary>
        /// @args: Takes two arguments - first the name of the directory containing the world and second the new name for
        /// that world. @desc: Renames the world by storing the new name in level.dat. It does *not* rename the directory
        /// containing the world data.
        /// </summary>
        public virtual void RenameWorld(string par1Str, string par2Str)
        {
            string file = IOPath.Combine(SavesDirectory, par1Str);

            if (!File.Exists(file))
            {
                return;
            }

            string file1 = IOPath.Combine(file, "level.dat");

            if (File.Exists(file1))
            {
                try
                {
                    NBTTagCompound nbttagcompound  = CompressedStreamTools.ReadCompressed(new FileStream(file1, FileMode.Open));
                    NBTTagCompound nbttagcompound1 = nbttagcompound.GetCompoundTag("Data");
                    nbttagcompound1.SetString("LevelName", par2Str);
                    CompressedStreamTools.WriteCompressed(nbttagcompound, new FileStream(file1, FileMode.Create));
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
            }
        }
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetByte("Dir", (byte)Direction);
     par1NBTTagCompound.SetString("Motive", Art.Title);
     par1NBTTagCompound.SetInteger("TileX", XPosition);
     par1NBTTagCompound.SetInteger("TileY", YPosition);
     par1NBTTagCompound.SetInteger("TileZ", ZPosition);
 }
        /// <summary>
        /// Writes a tile entity to NBT.
        /// </summary>
        public virtual void WriteToNBT(NBTTagCompound par1NBTTagCompound)
        {
            string s = ClassToNameMap[this.GetType()];

            if (s == null)
            {
                throw new Exception((new StringBuilder()).Append(this.GetType()).Append(" is missing a mapping! This is a bug!").ToString());
            }
            else
            {
                par1NBTTagCompound.SetString("id", s);
                par1NBTTagCompound.SetInteger("x", XCoord);
                par1NBTTagCompound.SetInteger("y", YCoord);
                par1NBTTagCompound.SetInteger("z", ZCoord);
                return;
            }
        }