Ejemplo n.º 1
0
        public override bool TryGiveItemStack(ItemStack itemstack)
        {
            if (itemstack == null || itemstack.StackSize == 0)
            {
                return(false);
            }

            ItemSlot dummySlot = new DummySlot(null);

            dummySlot.Itemstack = itemstack.Clone();

            ItemStackMoveOperation op = new ItemStackMoveOperation(World, EnumMouseButton.Left, 0, EnumMergePriority.AutoMerge, itemstack.StackSize);

            WeightedSlot wslot = inv.GetBestSuitedSlot(dummySlot, new List <ItemSlot>());

            if (wslot.weight > 0)
            {
                dummySlot.TryPutInto(wslot.slot, ref op);
                itemstack.StackSize -= op.MovedQuantity;
                WatchedAttributes.MarkAllDirty();
                return(op.MovedQuantity > 0);
            }

            return(false);
        }