CanReceiveItemIntoCargo doesn't seem to be respected when it comes to creating new items. Below is a use case I'm currently using in one of my mods. When using
CreateItemInInventory on the player object, if there is no available inventory space in clothing cargo or child cargos, the item is placed inside the object where it is disallowed. CanReceiveItemIntoCargo does prevent UI usage of moving an item into cargo.
class DogtagCase : ItemBase { // only allow dogtags into the container override bool CanReceiveItemIntoCargo(EntityAI item) { if (!super.CanReceiveItemIntoCargo(item)) return false; if (!item.IsKindOf("Dogtag_Base")) return false; return true; } override bool CanLoadItemIntoCargo(EntityAI item) { if (!super.CanLoadItemIntoCargo(item)) return false; if (!item.IsKindOf("Dogtag_Base")) return false; return true; } override bool CanSwapItemInCargo(EntityAI child_entity, EntityAI new_entity) { if (!super.CanSwapItemInCargo(child_entity, new_entity)) return false; if (!new_entity.IsKindOf("Dogtag_Base")) return false; return true; } }