public virtual void SetContents(ItemStack containerStack, ItemStack[] stacks) { TreeAttribute stacksTree = new TreeAttribute(); for (int i = 0; i < stacks.Length; i++) { stacksTree[i + ""] = new ItemstackAttribute(stacks[i]); } containerStack.Attributes["contents"] = stacksTree; }
public virtual void SetContents(ItemStack containerStack, ItemStack[] stacks) { if (stacks == null || stacks.Length == 0) { containerStack.Attributes.RemoveAttribute("contents"); return; } TreeAttribute stacksTree = new TreeAttribute(); for (int i = 0; i < stacks.Length; i++) { stacksTree[i + ""] = new ItemstackAttribute(stacks[i]); } containerStack.Attributes["contents"] = stacksTree; }