private object CanMoveItemFrom(ContainerController controller, Item item, PlayerInventory playerLoot, int slot, int amount) { if (controller == null || item.amount == amount) { return(null); // That's all legal, calm down } PrintDebug("Changing main item amount"); var mainItem = controller.Container.GetSlot(0); if (mainItem == null) { return(false); // Just cancel. Illegal! } mainItem.amount = item.amount - amount; // Change main item amount and refresh content. // Next frame because else it will change already existing item which may result in a wrong amount of the item :( NextFrame(() => controller.UpdateContent(0)); return(null); // That's legal, we'll do everything }