Example #1
0
        public override void Swap(Container container)
        {
            if (ItemStack.IsEmpty())
            {
                return;
            }

            if (!container.ItemStack.IsEmpty() && container.ItemStack.Item.ItemId != ItemStack.Item.ItemId)
            {
                return;
            }

            var ks = Keyboard.GetState();

            if (ks.IsKeyDown(Keys.LeftControl))
            {
                for (int i = ItemStack.ItemsCount; i > 0 && !container.ItemStack.IsFull(); i--)
                {
                    container.Add(ItemStack.Item);
                    ItemStack.Remove();
                    _tileEntity.Craft();
                }
            }
            else
            {
                container.Add(ItemStack.Item);
                ItemStack.Remove();
                _tileEntity.Craft();
            }
        }