Пример #1
0
        /// <summary>
        /// Saves the given MapDataBase to disk.
        /// </summary>
        private void SaveData(WorldSavedData par1WorldSavedData)
        {
            if (SaveHandler == null)
            {
                return;
            }

            try
            {
                string file = SaveHandler.GetMapFileFromName(par1WorldSavedData.MapName);

                if (file != null)
                {
                    NBTTagCompound nbttagcompound = new NBTTagCompound();
                    par1WorldSavedData.WriteToNBT(nbttagcompound);
                    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                    nbttagcompound1.SetCompoundTag("data", nbttagcompound);
                    FileStream fileoutputstream = new FileStream(file, FileMode.Create);
                    CompressedStreamTools.WriteCompressed(nbttagcompound1, fileoutputstream);
                    fileoutputstream.Close();
                }
            }
            catch (Exception exception)
            {
                Utilities.LogException(exception);
            }
        }
Пример #2
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>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetShort("Health", (sbyte)Health);
     par1NBTTagCompound.SetShort("Age", (short)Age);
     par1NBTTagCompound.SetCompoundTag("Item", ItemStack.WriteToNBT(new NBTTagCompound()));
 }