Interface ExtractionOnlyStorage<T>
- All Superinterfaces:
Iterable<StorageView<T>>,Storage<T>
- All Known Implementing Classes:
FullItemFluidStorage
A
Storage that supports extraction, and not insertion.
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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault longinsert(T resource, long maxAmount, TransactionContext transaction) Try to insert up to some amount of a resource into this storage.default booleanReturn false if callingStorage.insert(T, long, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext)will absolutely always return 0, or true otherwise or in doubt.Methods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.Storage
exactView, extract, getVersion, iterator, nonEmptyIterator, nonEmptyViews, simulateExtract, simulateInsert, supportsExtraction
-
Method Details
-
supportsInsertion
default boolean supportsInsertion()Description copied from interface:StorageReturn false if callingStorage.insert(T, long, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext)will absolutely always return 0, or true otherwise or in doubt.Note: This function is meant to be used by pipes or other devices that can transfer resources to know if they should interact with this storage at all.
- Specified by:
supportsInsertionin interfaceStorage<T>
-
insert
Description copied from interface:StorageTry to insert up to some amount of a resource into this storage.- Specified by:
insertin interfaceStorage<T>- Parameters:
resource- The resource to insert. May not be blank.maxAmount- The maximum amount of resource to insert. May not be negative.transaction- The transaction this operation is part of.- Returns:
- A non-negative integer not greater than maxAmount: the amount that was inserted.
-