public override bool GetInventory(int slot, out short itemID, out short Damage, out byte Count, out string failreason)
{
itemID = 0;
Damage = 0;
Count = 0;
failreason = "No error.";
// /Player/Inventory/
if (mRoot == null)
{
failreason = "root==null";
return false;
}
if (mRoot.RootTag == null)
{
failreason = "root.RootTag==null";
return false;
}
//NbtCompound Data = (NbtCompound)root.RootTag["Data"];
//NbtCompound Player = (NbtCompound)Data["Player"];
//NbtList pi = (NbtList)Player["Inventory"];
NbtList pi = mRoot.Query<NbtList>("//Data/Player/Inventory");
foreach (NbtTag t in pi.Tags)
{
NbtCompound s = (NbtCompound)t;
if ((s["Slot"] as NbtByte).Value == (byte)slot)
{
Count = (s["Count"] as NbtByte).Value;
itemID = (s["id"] as NbtShort).Value;
Damage = (s["Damage"] as NbtShort).Value;
return true;
}
}
failreason = "Slot is empty.";
return false;
}