-
-
Notifications
You must be signed in to change notification settings - Fork 388
/
Copy pathIContainer.cs
54 lines (42 loc) · 2.26 KB
/
IContainer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using StardewValley;
using StardewValley.Inventories;
using StardewValley.Mods;
namespace Pathoschild.Stardew.Automate;
/// <summary>Provides and stores items for machines.</summary>
public interface IContainer : IAutomatable, IEnumerable<ITrackedStack>
{
/*********
** Accessors
*********/
/// <summary>The container name (if any).</summary>
string Name { get; }
/// <summary>The raw mod data for the container.</summary>
ModDataDictionary ModData { get; }
/// <summary>Whether this is a Junimo chest, which shares a global inventory with all other Junimo chests.</summary>
bool IsJunimoChest { get; }
/// <summary>Whether this chest is locked (e.g. because a player has it open).</summary>
bool IsLocked { get; }
/// <summary>An object instance which uniquely identifies the underlying inventory.</summary>
/// <remarks>Normal chests should have a unique instance, while chests with shared inventories (like Junimo Chests) should share this instance too. This isn't necessarily the inventory itself, though that's the default implementation.</remarks>
object InventoryReferenceId { get; }
/// <summary>The underlying inventory.</summary>
IInventory Inventory { get; }
/*********
** Public methods
*********/
/// <summary>Find items in the pipe matching a predicate.</summary>
/// <param name="predicate">Matches items that should be returned.</param>
/// <param name="count">The number of items to find.</param>
/// <returns>If the pipe has no matching item, returns <c>null</c>. Otherwise returns a tracked item stack, which may have less items than requested if no more were found.</returns>
ITrackedStack? Get(Func<Item, bool> predicate, int count);
/// <summary>Store an item stack.</summary>
/// <param name="stack">The item stack to store.</param>
/// <remarks>If the storage can't hold the entire stack, it should reduce the tracked stack accordingly.</remarks>
void Store(ITrackedStack stack);
/// <summary>Get the number of item stacks currently stored in the container.</summary>
int GetFilled();
/// <summary>Get the total number of item stacks that can be stored in the container.</summary>
int GetCapacity();
}