OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Class InventoryExtensions

Inheritance
System.Object
InventoryExtensions
Namespace: OpenMod.Extensions.Games.Abstractions.Items
Assembly: OpenMod.Extensions.Games.Abstractions.dll
Syntax
public static class InventoryExtensions : object

Methods

| Improve this Doc View Source

ClearAsync(IInventory)

Removes all items from the given inventory.

Declaration
public static Task ClearAsync(this IInventory inventory)
Parameters
Type Name Description
IInventory inventory

The inventory to clear.

Returns
Type Description
Task
| Improve this Doc View Source

FindByAssetId(IInventory, String, Nullable<IComparer<IInventoryItem>>)

Searches for items by the item asset id.

Declaration
public static IEnumerable<IInventoryItem> FindByAssetId(this IInventory inventory, string itemAssetId, IComparer<IInventoryItem>? comparer = null)
Parameters
Type Name Description
IInventory inventory

The inventory to search in.

System.String itemAssetId

The ID of the item to search for.

System.Nullable<IComparer<IInventoryItem>> comparer

The optional item comparer.

Returns
Type Description
IEnumerable<IInventoryItem>
| Improve this Doc View Source

FindByAssetId(IInventoryPage, String, Nullable<IComparer<IInventoryItem>>)

Searches for items by the item asset id.

Declaration
public static IEnumerable<IInventoryItem> FindByAssetId(this IInventoryPage page, string itemAssetId, IComparer<IInventoryItem>? comparer = null)
Parameters
Type Name Description
IInventoryPage page

The inventory page to search in.

System.String itemAssetId

The ID of the item to search for.

System.Nullable<IComparer<IInventoryItem>> comparer

The optional item comparer.

Returns
Type Description
IEnumerable<IInventoryItem>
| Improve this Doc View Source

FindByType(IInventory, String, Nullable<IComparer<IInventoryItem>>)

Searches for items by the item type.

Declaration
public static IEnumerable<IInventoryItem> FindByType(this IInventory inventory, string itemType, IComparer<IInventoryItem>? comparer = null)
Parameters
Type Name Description
IInventory inventory

The inventory to search in.

System.String itemType

The type of the item to search for.

System.Nullable<IComparer<IInventoryItem>> comparer

The optional item comparer.

Returns
Type Description
IEnumerable<IInventoryItem>
| Improve this Doc View Source

FindByType(IInventoryPage, String, Nullable<IComparer<IInventoryItem>>)

Searches for items by the item type.

Declaration
public static IEnumerable<IInventoryItem> FindByType(this IInventoryPage page, string itemType, IComparer<IInventoryItem>? comparer = null)
Parameters
Type Name Description
IInventoryPage page

The inventory page to search in.

System.String itemType

The type of the item to search for.

System.Nullable<IComparer<IInventoryItem>> comparer

The optional item comparer.

Returns
Type Description
IEnumerable<IInventoryItem>