External storage API
raoulvdberge opened this issue ยท 3 comments
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
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.