示例#1
0
        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;
        }
示例#2
0
        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;
        }