コード例 #1
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);
            }
        }
コード例 #2
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);
 }