Skip to content

Item Pieces and Item Instance

Overview

UMIPItemInstance is the runtime object for a single inventory slot entry: it implements ISaveableLoadableObjectInterface and ISaveIdentifierInterface, holds piece references (stackable, equipment, durability, enhance, usable, etc.), and a FDynamicPieceList (replicated list of dynamic pieces). UMIPItemPiece is the base for all “pieces” (definition or runtime data attached to an item). UMIPItemPieceDynamic (and subclasses) are saveable/replicated and represent runtime state (e.g. cooldown, durability, enhanced stats). The inventory FMIPItemEntry holds the item instance (or reference); add/remove/load flow creates instances and pieces. See Inventory components.

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
UMIPItemInstance Public/Inventory/Instances/MIPItemInstance.h
UMIPItemPiece Public/Inventory/Pieces/MIPItemPiece.h
UMIPItemPieceDynamic Public/Inventory/Pieces/MIPItemPieceDynamic.h
UMIPItemPieceDynamicTemp Public/Inventory/Pieces/MIPItemPieceDynamicTemp.h
ItemPiece_* (definition pieces) Public/Inventory/Pieces/*.h
ItemPiece_* (dynamic pieces) Public/Inventory/Pieces/Dynamic/, TempDuration/, etc.

UMIPItemInstance

  • Interfaces: ISaveableLoadableObjectInterface, ISaveIdentifierInterface, IAbilitySystemInterface (for item-granted ASC if used), IGameplayTagAssetInterface.
  • Pieces: Definition pieces (stackable, class restrict, equipment, durability, enhance, usable, expiring, etc.) are resolved via GetOrSet() macros from the definition asset. Dynamic pieces (UMIPItemPieceDynamic) live in FDynamicPieceList* (replicated); e.g. ItemPiece_Durability, ItemPiece_DynamicEquipmentItemStats, ItemPiece_Cooldown, ItemPiece_ExpiringItem, ItemPiece_SoldToVendorItem.
  • Save/load: LoadThisUObjectFromJsonObject / LoadThisUObject; GetSaveIdentifier, GetListIdentifier. Persisted with the save system; server load creates instances and restores dynamic pieces.
  • Replication: FDynamicPieceList replicates; item entry in FMIPItemList replicates; instance is referenced by index or stored in entry.

UMIPItemPiece

  • Base: UObject; DefaultToInstanced, EditInlineNew, Abstract. OnInstanceCreated(InInstance); Instance (read-only) reference to owning UMIPItemInstance.

UMIPItemPieceDynamic

  • Base: UMIPItemPiece; ISaveIdentifierInterface, ISaveableLoadableObjectInterface. Runtime piece that is saved and replicated (e.g. durability, rolled stats, cooldown state).

UMIPItemPieceDynamicTemp

  • Base: UMIPItemPieceDynamic. Temporary duration (e.g. cooldown, expiring item); subclasses include ItemPiece_Cooldown, ItemPiece_ExpiringItem, ItemPiece_SoldToVendorItem. See Cooldown.

Piece types (examples)

  • Definition (from asset): ItemPiece_EquipmentDefinition, ItemPiece_UsableDefinition, ItemPiece_DurabilityDefinition, ItemPiece_EnhanceDefinition, ItemPiece_StackableDefinition, ItemPiece_ClassRestrictDefinition, etc. Define what the item is.
  • Dynamic (runtime): ItemPiece_Durability, ItemPiece_DynamicEquipmentItemStats, ItemPiece_Enhanceable, ItemPiece_Cooldown, ItemPiece_ExpiringItem. Represent current state (health, rolled stats, level, remaining time).

Integration

  • Inventory: MIPBaseInventoryManagerComponent creates instances via MakeNewItemInstance(), CreateNewItemEntry*, LoadItem; MarkPieceDirty for replication/save. Item entry holds reference to instance.
  • Equipment: UMIPEquipmentGE and equipment components read EquipmentDefinition and DynamicEquipmentItemStats pieces for stats.
  • Save: Saveable components and save operations serialize saveable pieces; load restores FDynamicPieceList and piece state.