Esempio n. 1
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetShort("xTile", (short)XTile);
     par1NBTTagCompound.SetShort("yTile", (short)YTile);
     par1NBTTagCompound.SetShort("zTile", (short)ZTile);
     par1NBTTagCompound.SetByte("inTile", (byte)InTile);
     par1NBTTagCompound.SetByte("inGround", (byte)(InGround ? 1 : 0));
 }
 /// <summary>
 /// write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities
 /// </summary>
 public override void WriteToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetByte("dimension", Dimension);
     par1NBTTagCompound.SetInteger("xCenter", XCenter);
     par1NBTTagCompound.SetInteger("zCenter", ZCenter);
     par1NBTTagCompound.SetByte("scale", Scale);
     par1NBTTagCompound.SetShort("width", (short)128);
     par1NBTTagCompound.SetShort("height", (short)128);
     par1NBTTagCompound.SetByteArray("colors", Colors);
 }
Esempio n. 3
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetShort("xTile", (short)XTile);
     par1NBTTagCompound.SetShort("yTile", (short)YTile);
     par1NBTTagCompound.SetShort("zTile", (short)ZTile);
     par1NBTTagCompound.SetByte("inTile", (byte)InTile);
     par1NBTTagCompound.SetByte("inData", (byte)InData);
     par1NBTTagCompound.SetByte("shake", (byte)ArrowShake);
     par1NBTTagCompound.SetByte("inGround", (byte)(InGround ? 1 : 0));
     par1NBTTagCompound.Setbool("player", DoesArrowBelongToPlayer);
     par1NBTTagCompound.SetDouble("damage", Damage);
 }
Esempio n. 4
0
        /// <summary>
        /// Write the stack fields to a NBT object. Return the new NBT object.
        /// </summary>
        public NBTTagCompound WriteToNBT(NBTTagCompound par1NBTTagCompound)
        {
            par1NBTTagCompound.SetShort("id", (short)ItemID);
            par1NBTTagCompound.SetByte("Count", (byte)StackSize);
            par1NBTTagCompound.SetShort("Damage", (short)ItemDamage);

            if (StackTagCompound != null)
            {
                par1NBTTagCompound.SetTag("tag", StackTagCompound);
            }

            return(par1NBTTagCompound);
        }
Esempio n. 5
0
        /// <summary>
        /// (abstract) Protected helper method to write subclass entity data to NBT.
        /// </summary>
        public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
        {
            par1NBTTagCompound.SetInteger("Type", MinecartType);

            if (MinecartType == 2)
            {
                par1NBTTagCompound.SetDouble("PushX", PushX);
                par1NBTTagCompound.SetDouble("PushZ", PushZ);
                par1NBTTagCompound.SetShort("Fuel", (short)Fuel);
            }
            else if (MinecartType == 1)
            {
                NBTTagList nbttaglist = new NBTTagList();

                for (int i = 0; i < CargoItems.Length; i++)
                {
                    if (CargoItems[i] != null)
                    {
                        NBTTagCompound nbttagcompound = new NBTTagCompound();
                        nbttagcompound.SetByte("Slot", (byte)i);
                        CargoItems[i].WriteToNBT(nbttagcompound);
                        nbttaglist.AppendTag(nbttagcompound);
                    }
                }

                par1NBTTagCompound.SetTag("Items", nbttaglist);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Adds a enchantments with a desired level on the ItemStack.
        /// </summary>
        public void AddEnchantment(Enchantment par1Enchantment, int par2)
        {
            if (StackTagCompound == null)
            {
                SetTagCompound(new NBTTagCompound());
            }

            if (!StackTagCompound.HasKey("ench"))
            {
                StackTagCompound.SetTag("ench", new NBTTagList("ench"));
            }

            NBTTagList     nbttaglist     = (NBTTagList)StackTagCompound.GetTag("ench");
            NBTTagCompound nbttagcompound = new NBTTagCompound();

            nbttagcompound.SetShort("id", (short)par1Enchantment.EffectId);
            nbttagcompound.SetShort("lvl", (sbyte)par2);
            nbttaglist.AppendTag(nbttagcompound);
        }
Esempio n. 7
0
        /// <summary>
        /// Writes a tile entity to NBT.
        /// </summary>
        public override void WriteToNBT(NBTTagCompound par1NBTTagCompound)
        {
            base.WriteToNBT(par1NBTTagCompound);
            par1NBTTagCompound.SetShort("BrewTime", (short)BrewTime);
            NBTTagList nbttaglist = new NBTTagList();

            for (int i = 0; i < BrewingItemStacks.Length; i++)
            {
                if (BrewingItemStacks[i] != null)
                {
                    NBTTagCompound nbttagcompound = new NBTTagCompound();
                    nbttagcompound.SetByte("Slot", (byte)i);
                    BrewingItemStacks[i].WriteToNBT(nbttagcompound);
                    nbttaglist.AppendTag(nbttagcompound);
                }
            }

            par1NBTTagCompound.SetTag("Items", nbttaglist);
        }
 /// <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()));
 }
Esempio n. 9
0
        /// <summary>
        /// Returns an unique new data id for the given prefix and saves the idCounts map to the 'idcounts' file.
        /// </summary>
        public virtual int GetUniqueDataId(string par1Str)
        {
            short short1 = IdCounts[par1Str];

            if (short1 == null)
            {
                short1 = 0;
            }
            else
            {
                short short2 = short1;
                short short3 = short1 = (short)(short1 + 1);
                short _tmp   = short2;
            }

            IdCounts[par1Str] = short1;

            if (SaveHandler == null)
            {
                return((short)short1);
            }

            try
            {
                string file = SaveHandler.GetMapFileFromName("idcounts");

                if (file != null)
                {
                    NBTTagCompound nbttagcompound = new NBTTagCompound();
                    string         s;
                    short          word0;

                    for (IEnumerator <string> iterator = IdCounts.Keys.GetEnumerator(); iterator.MoveNext(); nbttagcompound.SetShort(s, word0))
                    {
                        s     = (string)iterator.Current;
                        word0 = IdCounts[s];
                    }

                    BinaryWriter dataoutputstream = new BinaryWriter(new FileStream(file, FileMode.Create));
                    CompressedStreamTools.Write(nbttagcompound, dataoutputstream);
                    dataoutputstream.Close();
                }
            }
            catch (Exception exception)
            {
                Utilities.LogException(exception);
            }

            return((short)short1);
        }
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     base.WriteEntityToNBT(par1NBTTagCompound);
     par1NBTTagCompound.SetShort("Anger", (short)AngerLevel);
 }
Esempio n. 11
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     base.WriteEntityToNBT(par1NBTTagCompound);
     par1NBTTagCompound.SetShort("carried", (short)GetCarried());
     par1NBTTagCompound.SetShort("carriedData", (short)GetCarryingData());
 }
Esempio n. 12
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetShort("Health", (sbyte)XpOrbHealth);
     par1NBTTagCompound.SetShort("Age", (short)XpOrbAge);
     par1NBTTagCompound.SetShort("Value", (short)XpValue);
 }