> For the complete documentation index, see [llms.txt](https://alessandro-cristoffer.gitbook.io/inventory-system-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alessandro-cristoffer.gitbook.io/inventory-system-docs/overview/inventory-component.md).

# Inventory Component

## Overview

Handles the main inventory logic, storage, slot restrictions, and multiplayer replication.

**Replicated Fields:**

* `Inventory`: Array of s.`FItem`
* `MaxSlotsInInventory`: Maximum allowed slots.
* `SlotRestrictions`: Optional restrictions per slot (allowed item types).

**Blueprint Delegates:**

* `FOnItemAdded`
* `FOnItemRemoved`

**Core Functions:**

* `TryAddItem(...)`: Adds an item (stack or new slot).
* `RemoveItem(...)`: Removes quantity from a slot.
* `RemoveItemByDefinition(...)`
* `GetItemAtSlot(int32)`
* `HasItem(UItemDefinition*)`
* `FindEmptySlot()`
* `FindSlotWithItem(UItemDefinition*)`

**Replication & Prediction:**

* `ServerRequestPickupItem()`
* `ClientConfirmPickup()`
* `ClientRejectPickup()`
* `ServerModifyInventory()`

## Slot Restriction Example

```
FInventorySlotRestriction Restriction;
Restriction.bAcceptAllTypes = false;
Restriction.AllowedItemTypes = { FGameplayTag::RequestGameplayTag("Item.Weapon") };
```
