OpenMinecraft.InfdevHandler.SetInventory C# (CSharp) Method

SetInventory() public method

public SetInventory ( int slot, short itemID, int Damage, int Count ) : bool
slot int
itemID short
Damage int
Count int
return bool
		public override bool SetInventory(int slot, short itemID, int Damage, int Count)
		{
			// /Player/Inventory/
			NbtCompound Slot = new NbtCompound();
			Slot.Add(new NbtByte("Count",(byte)Count));
			Slot.Add(new NbtShort("id",(short)itemID));
			Slot.Add(new NbtShort("Damage",(short)Damage));
			Slot.Add(new NbtByte("Slot", (byte)slot));

			NbtCompound Data = (NbtCompound)mRoot.RootTag["Data"];
			NbtCompound Player = (NbtCompound)Data["Player"];
			NbtList pi = (NbtList)Player["Inventory"];
			bool Found = false;
			for(int i=0;i<pi.Tags.Count;i++)
			{
				if (((pi[i] as NbtCompound)["Slot"] as NbtByte).Value == (byte)slot)
				{
					Found = true;
					pi[i] = Slot;
				}
			}
			if(!Found)
				pi.Add(Slot);
			Player["Inventory"] = pi;
			Data["Player"] = Player;
			mRoot.RootTag["Data"] = Data;
			return true;
		}