Interface StorageView<T>
- Type Parameters:
T
- The type of the stored resource.
- All Known Subinterfaces:
SingleSlotStorage<T>
- All Known Implementing Classes:
BlankVariantView
,FullItemFluidStorage
,SingleFluidStorage
,SingleStackStorage
,SingleVariantStorage
Deprecated.
Experimental feature, we reserve the right to remove or change it without further notice.
The transfer API is a complex addition, and we want to be able to correct possible design mistakes.
A view of a single stored resource in a
Storage
, for use with Storage.iterator(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext)
or Storage.exactView(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext, T)
.
A view is always tied to a specific transaction, and should not be accessed outside of it.
-
Method Summary
Modifier and TypeMethodDescriptionlong
extract(T resource, long maxAmount, TransactionContext transaction)
Deprecated.Try to extract a resource from this view.long
Deprecated.long
Deprecated.Deprecated.boolean
Deprecated.
-
Method Details
-
extract
Deprecated.Try to extract a resource from this view.- Returns:
- The amount that was extracted.
-
isResourceBlank
boolean isResourceBlank()Deprecated.- Returns:
true
if thegetResource()
contained in this storage view is blank, orfalse
otherwise.
-
getResource
T getResource()Deprecated.- Returns:
- The resource stored in this view. May not be blank if
isResourceBlank()
isfalse
.
-
getAmount
long getAmount()Deprecated.- Returns:
- The amount of
getResource()
stored in this view.
-
getCapacity
long getCapacity()Deprecated.- Returns:
- The total amount of
getResource()
that could be stored in this view, or an estimate of the number of resources that could be stored if this view has a blank resource.
-