fn matching_item_count( stack: &ItemStack, predicate: &dyn Fn(&ItemStack) -> bool, amount_to_remove: i32, counting_only: bool, ) -> i32