/// <summary> /// (abstract) Protected helper method to read subclass entity data from NBT. /// </summary> public override void ReadEntityFromNBT(NBTTagCompound par1NBTTagCompound) { MinecartType = par1NBTTagCompound.GetInteger("Type"); if (MinecartType == 2) { PushX = (float)par1NBTTagCompound.GetDouble("PushX"); PushZ = (float)par1NBTTagCompound.GetDouble("PushZ"); Fuel = par1NBTTagCompound.GetShort("Fuel"); } else if (MinecartType == 1) { NBTTagList nbttaglist = par1NBTTagCompound.GetTagList("Items"); CargoItems = new ItemStack[GetSizeInventory()]; for (int i = 0; i < nbttaglist.TagCount(); i++) { NBTTagCompound nbttagcompound = (NBTTagCompound)nbttaglist.TagAt(i); int j = nbttagcompound.GetByte("Slot") & 0xff; if (j >= 0 && j < CargoItems.Length) { CargoItems[j] = ItemStack.LoadItemStackFromNBT(nbttagcompound); } } } }
/// <summary> /// (abstract) Protected helper method to read subclass entity data from NBT. /// </summary> public override void ReadEntityFromNBT(NBTTagCompound par1NBTTagCompound) { XTile = par1NBTTagCompound.GetShort("xTile"); YTile = par1NBTTagCompound.GetShort("yTile"); ZTile = par1NBTTagCompound.GetShort("zTile"); InTile = par1NBTTagCompound.GetByte("inTile") & 0xff; InData = par1NBTTagCompound.GetByte("inData") & 0xff; ArrowShake = par1NBTTagCompound.GetByte("shake") & 0xff; InGround = par1NBTTagCompound.GetByte("inGround") == 1; DoesArrowBelongToPlayer = par1NBTTagCompound.Getbool("player"); if (par1NBTTagCompound.HasKey("damage")) { Damage = par1NBTTagCompound.GetDouble("damage"); } }