/// <summary> /// Reads from the given tag list and fills the slots in the inventory with the correct items. /// </summary> public virtual void ReadFromNBT(NBTTagList par1NBTTagList) { MainInventory = new ItemStack[36]; ArmorInventory = new ItemStack[4]; for (int i = 0; i < par1NBTTagList.TagCount(); i++) { NBTTagCompound nbttagcompound = (NBTTagCompound)par1NBTTagList.TagAt(i); int j = nbttagcompound.GetByte("Slot") & 0xff; ItemStack itemstack = ItemStack.LoadItemStackFromNBT(nbttagcompound); if (itemstack == null) { continue; } if (j >= 0 && j < MainInventory.Length) { MainInventory[j] = itemstack; } if (j >= 100 && j < ArmorInventory.Length + 100) { ArmorInventory[j - 100] = itemstack; } } }
/// <summary> /// Reads a tile entity from NBT. /// </summary> public override void ReadFromNBT(NBTTagCompound par1NBTTagCompound) { base.ReadFromNBT(par1NBTTagCompound); NBTTagList nbttaglist = par1NBTTagCompound.GetTagList("Items"); ChestContents = 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 < ChestContents.Length) { ChestContents[j] = ItemStack.LoadItemStackFromNBT(nbttagcompound); } } }
/// <summary> /// Reads a tile entity from NBT. /// </summary> public override void ReadFromNBT(NBTTagCompound par1NBTTagCompound) { base.ReadFromNBT(par1NBTTagCompound); NBTTagList nbttaglist = par1NBTTagCompound.GetTagList("Items"); FurnaceItemStacks = new ItemStack[GetSizeInventory()]; for (int i = 0; i < nbttaglist.TagCount(); i++) { NBTTagCompound nbttagcompound = (NBTTagCompound)nbttaglist.TagAt(i); byte byte0 = nbttagcompound.GetByte("Slot"); if (byte0 >= 0 && byte0 < FurnaceItemStacks.Length) { FurnaceItemStacks[byte0] = ItemStack.LoadItemStackFromNBT(nbttagcompound); } } FurnaceBurnTime = par1NBTTagCompound.GetShort("BurnTime"); FurnaceCookTime = par1NBTTagCompound.GetShort("CookTime"); CurrentItemBurnTime = GetItemBurnTime(FurnaceItemStacks[1]); }