Class TransferHelper
java.lang.Object
com.refinedmods.refinedstorage.api.storage.TransferHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
transfer
(ResourceKey resource, long amount, Actor actor, ExtractableStorage source, InsertableStorage destination, InsertableStorage fallback) Transfers a given resource and amount from source to destination.
-
Method Details
-
transfer
public static long transfer(ResourceKey resource, long amount, Actor actor, ExtractableStorage source, InsertableStorage destination, @Nullable InsertableStorage fallback) Transfers a given resource and amount from source to destination. If there is not enough stored of the given resource in the source, it will only try to extract what's there. If there is not enough space in the destination, it will only insert for the space that's there. If the last eventual insert into the destination after all these checks fails or only partly succeeds, the fallback storage will be used to reinsert leftovers in. If there's no fallback inventory given in that case, aIllegalStateException
will be thrown.- Parameters:
resource
- the resourceamount
- the amount to transferactor
- the actor performing the transfersource
- the source to extract fromdestination
- the destination to insert tofallback
- the fallback to insert leftovers in- Returns:
- the amount transferred
-