Refined Storage

Refined Storage

77M Downloads

External storage API

raoulvdberge opened this issue ยท 3 comments

commented
commented

My recommendation: Capability<IExternalItemStorage>

IExternalItemStorage:

/**
 * @author LatvianModder
 */
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public interface IExternalItemStorage
{
	class ItemEntry
	{
		public final ItemStack type;
		public final int count;
		public final int capacity; //Is this even needed?

		public ItemEntry(ItemStack type, int count, int capacity)
		{
			this.type = type;
			this.count = count;
			this.capacity = capacity;
		}
	}

	Collection<ItemEntry> getStoredItems();

	ItemStack insert(ItemStack stack, boolean simulate);

	ItemStack extract(ItemStack type, int size, int flags, boolean simulate);

	default int getPriority()
	{
		return 0;
	}

	default AccessType getAccessType()
	{
		return AccessType.INSERT_EXTRACT;
	}
}

Tanks dont really need that, since FluidStack doesnt have stack size limitations

commented

No... you are just copying the interface of IStorage here. It will stay an IStorage, but provided through an IExternalStorageProvider. The main difference with IExternalStorageProvider/IStorageProvider will be that a supplier will be given to retrieve the external storage properties like priority and access type.

commented

IStorage doesn't have capacity though, it would be nice to have that