Example #1
0
        protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                           nbttagcompound)
        {
            direction = nbttagcompound.GetByte("Dir");
            xPosition = nbttagcompound.GetInteger("TileX");
            yPosition = nbttagcompound.GetInteger("TileY");
            zPosition = nbttagcompound.GetInteger("TileZ");
            string s = nbttagcompound.GetString("Motive");

            net.minecraft.src.EnumArt[] aenumart = net.minecraft.src.EnumArt.Values();
            int i = aenumart.Length;

            for (int j = 0; j < i; j++)
            {
                net.minecraft.src.EnumArt enumart = aenumart[j];
                if (enumart.title.Equals(s))
                {
                    art = enumart;
                }
            }
            if (art == null)
            {
                art = net.minecraft.src.EnumArt.Kebab;
            }
            Func_179_a(direction);
        }
Example #2
0
 private void Func_28175_a(net.minecraft.src.MapDataBase mapdatabase)
 {
     if (field_28180_a == null)
     {
         return;
     }
     try
     {
         string file = field_28180_a.Func_28111_b(mapdatabase.field_28152_a);
         if (file != null)
         {
             net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                                   ();
             mapdatabase.Func_28147_b(nbttagcompound);
             net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                    ();
             nbttagcompound1.SetCompoundTag("data", nbttagcompound);
             using (FileStream fileoutputstream = File.OpenWrite(file))
                 net.minecraft.src.CompressedStreamTools.WriteGzippedCompoundToOutputStream(nbttagcompound1
                                                                                            , fileoutputstream);
         }
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
 }
Example #3
0
 public static net.minecraft.src.TileEntity CreateAndLoadEntity(net.minecraft.src.NBTTagCompound
                                                                nbttagcompound)
 {
     net.minecraft.src.TileEntity tileentity = null;
     try
     {
         System.Type class1 = (System.Type)nameToClassMap[nbttagcompound.GetString
                                                              ("id")];
         if (class1 != null)
         {
             tileentity = (net.minecraft.src.TileEntity)Activator.CreateInstance(class1);
         }
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
     if (tileentity != null)
     {
         tileentity.ReadFromNBT(nbttagcompound);
     }
     else
     {
         System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Skipping TileEntity with id "
                                                                             ).Append(nbttagcompound.GetString("id")).ToString());
     }
     return(tileentity);
 }
Example #4
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetInteger("Type", minecartType);
     if (minecartType == 2)
     {
         nbttagcompound.SetDouble("PushX", pushX);
         nbttagcompound.SetDouble("PushZ", pushZ);
         nbttagcompound.SetShort("Fuel", (short)fuel);
     }
     else
     {
         if (minecartType == 1)
         {
             net.minecraft.src.NBTTagList nbttaglist = new net.minecraft.src.NBTTagList();
             for (int i = 0; i < cargoItems.Length; i++)
             {
                 if (cargoItems[i] != null)
                 {
                     net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                            ();
                     nbttagcompound1.SetByte("Slot", unchecked ((byte)i));
                     cargoItems[i].WriteToNBT(nbttagcompound1);
                     nbttaglist.SetTag(nbttagcompound1);
                 }
             }
             nbttagcompound.SetTag("Items", nbttaglist);
         }
     }
 }
Example #5
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                    nbttagcompound)
 {
     base.ReadEntityFromNBT(nbttagcompound);
     dataWatcher.UpdateObject(17, unchecked ((byte)(nbttagcompound.GetBoolean
                                                        ("powered") ? 1 : 0)));
 }
Example #6
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                    nbttagcompound)
 {
     minecartType = nbttagcompound.GetInteger("Type");
     if (minecartType == 2)
     {
         pushX = nbttagcompound.GetDouble("PushX");
         pushZ = nbttagcompound.GetDouble("PushZ");
         fuel  = nbttagcompound.GetShort("Fuel");
     }
     else
     {
         if (minecartType == 1)
         {
             net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items");
             cargoItems = new net.minecraft.src.ItemStack[GetSizeInventory()];
             for (int i = 0; i < nbttaglist.TagCount(); i++)
             {
                 net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound
                                                                     )nbttaglist.TagAt(i);
                 int j = nbttagcompound1.GetByte("Slot");
                 if (j >= 0 && j < cargoItems.Length)
                 {
                     cargoItems[j] = new net.minecraft.src.ItemStack(nbttagcompound1);
                 }
             }
         }
     }
 }
Example #7
0
 public static net.minecraft.src.Entity CreateEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                            nbttagcompound, net.minecraft.src.World world)
 {
     net.minecraft.src.Entity entity = null;
     try
     {
         System.Type class1 = (System.Type)stringToClassMapping[nbttagcompound.GetString
                                                                    ("id")];
         if (class1 != null)
         {
             entity = (net.minecraft.src.Entity)class1.GetConstructor(new System.Type[] { Sharpen.Runtime.GetClassForType(typeof(net.minecraft.src.World)) }).Invoke(new object[] { world });
         }
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
     if (entity != null)
     {
         entity.ReadFromNBT(nbttagcompound);
     }
     else
     {
         System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Skipping Entity with id "
                                                                             ).Append(nbttagcompound.GetString("id")).ToString());
     }
     return(entity);
 }
Example #8
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetShort("Health", unchecked ((byte)health));
     nbttagcompound.SetShort("Age", (short)age);
     nbttagcompound.SetCompoundTag("Item", item.WriteToNBT(new net.minecraft.src.NBTTagCompound()));
 }
Example #9
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     health = nbttagcompound.GetShort("Health") & 0xff;
     age    = nbttagcompound.GetShort("Age");
     net.minecraft.src.NBTTagCompound nbttagcompound1 = nbttagcompound.GetCompoundTag("Item");
     item = new net.minecraft.src.ItemStack(nbttagcompound1);
 }
Example #10
0
 public virtual void ReadFromNBT(net.minecraft.src.NBTTagList nbttaglist)
 {
     mainInventory  = new net.minecraft.src.ItemStack[36];
     armorInventory = new net.minecraft.src.ItemStack[4];
     for (int i = 0; i < nbttaglist.TagCount(); i++)
     {
         net.minecraft.src.NBTTagCompound nbttagcompound = (net.minecraft.src.NBTTagCompound
                                                            )nbttaglist.TagAt(i);
         int j = nbttagcompound.GetByte("Slot");
         net.minecraft.src.ItemStack itemstack = new net.minecraft.src.ItemStack(nbttagcompound
                                                                                 );
         if (itemstack.GetItem() == null)
         {
             continue;
         }
         if (j >= 0 && j < mainInventory.Length)
         {
             mainInventory[j] = itemstack;
         }
         if (j >= 100 && j < armorInventory.Length + 100)
         {
             armorInventory[j - 100] = itemstack;
         }
     }
 }
Example #11
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                    nbttagcompound)
 {
     base.ReadEntityFromNBT(nbttagcompound);
     SetSheared(nbttagcompound.GetBoolean("Sheared"));
     SetFleeceColor(nbttagcompound.GetByte("Color"));
 }
Example #12
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     base.WriteEntityToNBT(nbttagcompound);
     nbttagcompound.SetBoolean("Sheared", Func_21069_f_());
     nbttagcompound.SetByte("Color", unchecked ((byte)GetFleeceColor()));
 }
Example #13
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 #14
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void SaveChunk(net.minecraft.src.World world, net.minecraft.src.Chunk
                               chunk)
 {
     world.CheckSessionLock();
     try
     {
         java.io.DataOutputStream dataoutputstream = net.minecraft.src.RegionFileCache.Func_22120_d
                                                         (worldFolder, chunk.xPosition, chunk.zPosition);
         net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                               ();
         net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                ();
         nbttagcompound.SetTag("Level", nbttagcompound1);
         net.minecraft.src.ChunkLoader.StoreChunkInCompound(chunk, world, nbttagcompound1);
         net.minecraft.src.CompressedStreamTools.Func_771_a(nbttagcompound, dataoutputstream
                                                            );
         dataoutputstream.Close();
         net.minecraft.src.WorldInfo worldinfo = world.GetWorldInfo();
         worldinfo.SetSizeOnDisk(worldinfo.GetSizeOnDisk() + (long)net.minecraft.src.RegionFileCache
                                 .Func_22121_b(worldFolder, chunk.xPosition, chunk.zPosition));
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
 }
Example #15
0
 public virtual void Func_22094_a(net.minecraft.src.WorldInfo worldinfo)
 {
     net.minecraft.src.NBTTagCompound nbttagcompound  = worldinfo.Func_22185_a();
     net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                            ();
     nbttagcompound1.SetTag("Data", nbttagcompound);
     try
     {
         string file  = System.IO.Path.Combine(worldDir, "level.dat_new");
         string file1 = System.IO.Path.Combine(worldDir, "level.dat_old");
         string file2 = System.IO.Path.Combine(worldDir, "level.dat");
         using (FileStream fs = File.OpenWrite(file))
             net.minecraft.src.CompressedStreamTools.WriteGzippedCompoundToOutputStream(nbttagcompound1, fs);
         if (File.Exists(file1))
         {
             File.Delete(file1);
         }
         File.Move(file2, file1);
         if (File.Exists(file2))
         {
             File.Delete(file2);
         }
         File.Move(file, file2);
         if (File.Exists(file))
         {
             File.Delete(file);
         }
     }
     catch (System.Exception exception)
     {
         Sharpen.Runtime.PrintStackTrace(exception);
     }
 }
Example #16
0
 public virtual net.minecraft.src.NBTTagList WriteToNBT(net.minecraft.src.NBTTagList
                                                        nbttaglist)
 {
     for (int i = 0; i < mainInventory.Length; i++)
     {
         if (mainInventory[i] != null)
         {
             net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                                   ();
             nbttagcompound.SetByte("Slot", unchecked ((byte)i));
             mainInventory[i].WriteToNBT(nbttagcompound);
             nbttaglist.SetTag(nbttagcompound);
         }
     }
     for (int j = 0; j < armorInventory.Length; j++)
     {
         if (armorInventory[j] != null)
         {
             net.minecraft.src.NBTTagCompound nbttagcompound1 = new net.minecraft.src.NBTTagCompound
                                                                    ();
             nbttagcompound1.SetByte("Slot", unchecked ((byte)(j + 100)));
             armorInventory[j].WriteToNBT(nbttagcompound1);
             nbttaglist.SetTag(nbttagcompound1);
         }
     }
     return(nbttaglist);
 }
Example #17
0
 public virtual net.minecraft.src.NBTTagCompound Func_22185_a()
 {
     net.minecraft.src.NBTTagCompound nbttagcompound = new net.minecraft.src.NBTTagCompound
                                                           ();
     SaveNBTTag(nbttagcompound, field_22195_h);
     return(nbttagcompound);
 }
Example #18
0
 public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.WriteToNBT(nbttagcompound);
     nbttagcompound.SetString("Text1", Lines[0]);
     nbttagcompound.SetString("Text2", Lines[1]);
     nbttagcompound.SetString("Text3", Lines[2]);
     nbttagcompound.SetString("Text4", Lines[3]);
 }
Example #19
0
 public net.minecraft.src.NBTTagCompound WriteToNBT(net.minecraft.src.NBTTagCompound
                                                    nbttagcompound)
 {
     nbttagcompound.SetShort("id", (short)itemID);
     nbttagcompound.SetByte("Count", unchecked ((byte)stackSize));
     nbttagcompound.SetShort("Damage", (short)itemDamage);
     return(nbttagcompound);
 }
Example #20
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetShort("Health", (short)health);
     nbttagcompound.SetShort("HurtTime", (short)hurtTime);
     nbttagcompound.SetShort("DeathTime", (short)deathTime);
     nbttagcompound.SetShort("AttackTime", (short)attackTime);
 }
Example #21
0
 public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.WriteToNBT(nbttagcompound);
     if (field_28009_a > 0)
     {
         nbttagcompound.SetInteger("Record", field_28009_a);
     }
 }
Example #22
0
 public override void WriteToNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.WriteToNBT(nbttagcompound);
     nbttagcompound.SetInteger("blockId", storedBlockID);
     nbttagcompound.SetInteger("blockData", storedMetadata);
     nbttagcompound.SetInteger("facing", storedOrientation);
     nbttagcompound.SetFloat("progress", lastProgress);
     nbttagcompound.SetBoolean("extending", isExtending);
 }
Example #23
0
 public virtual void ReadPlayerData(net.minecraft.src.EntityPlayer entityplayer)
 {
     net.minecraft.src.NBTTagCompound nbttagcompound = GetPlayerData(entityplayer.username
                                                                     );
     if (nbttagcompound != null)
     {
         entityplayer.ReadFromNBT(nbttagcompound);
     }
 }
Example #24
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     base.WriteEntityToNBT(nbttagcompound);
     if (dataWatcher.GetWatchableObjectByte(17) == 1)
     {
         nbttagcompound.SetBoolean("powered", true);
     }
 }
Example #25
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetByte("Dir", unchecked ((byte)direction));
     nbttagcompound.SetString("Motive", art.title);
     nbttagcompound.SetInteger("TileX", xPosition);
     nbttagcompound.SetInteger("TileY", yPosition);
     nbttagcompound.SetInteger("TileZ", zPosition);
 }
Example #26
0
 public override void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.ReadFromNBT(nbttagcompound);
     storedBlockID     = nbttagcompound.GetInteger("blockId");
     storedMetadata    = nbttagcompound.GetInteger("blockData");
     storedOrientation = nbttagcompound.GetInteger("facing");
     lastProgress      = progress = nbttagcompound.GetFloat("progress");
     isExtending       = nbttagcompound.GetBoolean("extending");
 }
Example #27
0
 protected internal override void WriteEntityToNBT(net.minecraft.src.NBTTagCompound
                                                   nbttagcompound)
 {
     nbttagcompound.SetShort("xTile", (short)xTileSnowball);
     nbttagcompound.SetShort("yTile", (short)yTileSnowball);
     nbttagcompound.SetShort("zTile", (short)zTileSnowball);
     nbttagcompound.SetByte("inTile", unchecked ((byte)inTileSnowball));
     nbttagcompound.SetByte("shake", unchecked ((byte)shakeSnowball));
     nbttagcompound.SetByte("inGround", unchecked ((byte)(inGroundSnowball ? 1 : 0)));
 }
Example #28
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                    nbttagcompound)
 {
     xTileSnowball    = nbttagcompound.GetShort("xTile");
     yTileSnowball    = nbttagcompound.GetShort("yTile");
     zTileSnowball    = nbttagcompound.GetShort("zTile");
     inTileSnowball   = nbttagcompound.GetByte("inTile");
     shakeSnowball    = nbttagcompound.GetByte("shake");
     inGroundSnowball = nbttagcompound.GetByte("inGround") == 1;
 }
Example #29
0
 public override void Func_28147_b(net.minecraft.src.NBTTagCompound nbttagcompound
                                   )
 {
     nbttagcompound.SetByte("dimension", field_28162_d);
     nbttagcompound.SetInteger("xCenter", field_28164_b);
     nbttagcompound.SetInteger("zCenter", field_28163_c);
     nbttagcompound.SetByte("scale", field_28161_e);
     nbttagcompound.SetShort("width", (short)128);
     nbttagcompound.SetShort("height", (short)128);
     nbttagcompound.SetByteArray("colors", field_28160_f);
 }
Example #30
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.NBTTagCompound
                                                    nbttagcompound)
 {
     xTile         = nbttagcompound.GetShort("xTile");
     yTile         = nbttagcompound.GetShort("yTile");
     zTile         = nbttagcompound.GetShort("zTile");
     inTile        = nbttagcompound.GetByte("inTile");
     field_28011_h = nbttagcompound.GetByte("inData");
     arrowShake    = nbttagcompound.GetByte("shake");
     inGround      = nbttagcompound.GetByte("inGround") == 1;
     field_28012_a = nbttagcompound.GetBoolean("player");
 }