Example #1
0
        public virtual void WritePlayerData(net.minecraft.src.EntityPlayer entityplayer)
        {
            try
            {
                net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                                      ();
                entityplayer.WriteToNBT(nbttagcompound);
                string file  = System.IO.Path.Combine(worldFile, "_tmp_.dat");
                string file1 = System.IO.Path.Combine(worldFile, (new java.lang.StringBuilder()).Append(entityplayer.username).Append(".dat").ToString());
                using (FileStream fs = File.Open(file, FileMode.OpenOrCreate))
                    net.minecraft.src.CompressedStreamTools.WriteGzippedCompoundToOutputStream(nbttagcompound, fs);
                if (File.Exists(file1))
                {
                    File.Delete(file1);
                }
                File.Move(file, file1);
            }
#if !DEBUG
            catch (System.Exception)
            {
                logger.Warning((new java.lang.StringBuilder()).Append("Failed to save player data for "
                                                                      ).Append(entityplayer.username).ToString());
            }
#else
            finally { }
#endif
        }
Example #2
0
 public virtual net.minecraft.src.NBTTagCompound Func_22183_a(List <EntityPlayer> list)
 {
     net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                           ();
     net.minecraft.src.EntityPlayer   entityplayer    = null;
     net.minecraft.src.NBTTagCompound nbttagcompound1 = null;
     if (list.Count > 0)
     {
         entityplayer = (net.minecraft.src.EntityPlayer)list[0];
     }
     if (entityplayer != null)
     {
         nbttagcompound1 = new net.minecraft.src.NBTTagCompound();
         entityplayer.WriteToNBT(nbttagcompound1);
     }
     SaveNBTTag(nbttagcompound, nbttagcompound1);
     return(nbttagcompound);
 }