Table of Contents

Interface IStackable<T>

Namespace
FishMMO.Shared.Core
Assembly
FishMMO.Shared.dll

Interface for objects that can be stacked together, such as items or resources. Provides methods for stack management and splitting.

public interface IStackable<T>

Type Parameters

T

The type of object that can be stacked.

Methods

AddToStack(T)

Adds the specified object to the current stack if possible.

bool AddToStack(T other)

Parameters

other T

The object to add to the stack.

Returns

bool

True if the object was successfully added, false otherwise.

CanAddToStack(T)

Determines if the specified object can be added to the current stack.

bool CanAddToStack(T other)

Parameters

other T

The object to check for stack compatibility.

Returns

bool

True if the object can be added to the stack, false otherwise.

TryUnstack(uint, out T)

Attempts to remove a specified amount from the stack, returning the split stack if successful.

bool TryUnstack(uint amount, out T stack)

Parameters

amount uint

The amount to unstack.

stack T

The resulting stack after unstacking.

Returns

bool

True if the unstack operation was successful, false otherwise.