Class CombinedStorage<T,S extends Storage<T>>
- Type Parameters:
T- The type of the stored resources.S- The class of every part.? extends Storage<T>can be used if the parts are of different types.
- All Implemented Interfaces:
Storage<T>
Storage wrapping multiple storages.
The storages passed to the constructor will be iterated in order.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongextract(T resource, long maxAmount, TransactionContext transaction)Deprecated.Try to extract up to some amount of a resource from this storage.longinsert(T resource, long maxAmount, TransactionContext transaction)Deprecated.Try to insert up to some amount of a resource into this storage.iterator(TransactionContext transaction)Deprecated.Iterate through the contents of this storage, for the scope of the passed transaction.booleanDeprecated.Return false if callingStorage.extract(T, long, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext)will absolutely always return 0, or true otherwise or in doubt.booleanDeprecated.Return 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.Storage
exactView, getVersion, iterable, simulateExtract, simulateInsert
-
Field Details
-
parts
Deprecated.
-
-
Constructor Details
-
CombinedStorage
Deprecated.
-
-
Method Details
-
supportsInsertion
public boolean supportsInsertion()Deprecated.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
Deprecated.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 nonnegative integer not greater than maxAmount: the amount that was inserted.
-
supportsExtraction
public boolean supportsExtraction()Deprecated.Description copied from interface:StorageReturn false if callingStorage.extract(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:
supportsExtractionin interfaceStorage<T>
-
extract
Deprecated.Description copied from interface:StorageTry to extract up to some amount of a resource from this storage.- Specified by:
extractin interfaceStorage<T>- Parameters:
resource- The resource to extract. May not be blank.maxAmount- The maximum amount of resource to extract. May not be negative.transaction- The transaction this operation is part of.- Returns:
- A nonnegative integer not greater than maxAmount: the amount that was extracted.
-
iterator
Deprecated.Description copied from interface:StorageIterate through the contents of this storage, for the scope of the passed transaction. Every visitedStorageViewrepresents a stored resource and an amount. The iterator doesn't guarantee that a single resource only occurs once during an iteration.The returned iterator and any view it returns are only valid for the scope of to the passed transaction. They should not be used once that transaction is closed.
More precisely, as soon as the transaction is closed,
hasNext()must returnfalse, and any call tonext()must throw aNoSuchElementException.Storage.insert(T, long, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext)andStorage.extract(T, long, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext)may be called safely during iteration. Extractions should be visible to an open iterator, but insertions are not required to. In particular, inventories with a fixed amount of slots may wish to make insertions visible to iterators, but inventories with a dynamic or very large amount of slots should not do that to ensure timely termination of the iteration.
-