Class TransferHelper

java.lang.Object
com.refinedmods.refinedstorage.api.storage.TransferHelper

@API(status=STABLE, since="2.0.0-milestone.2.1") public final class TransferHelper extends Object
  • 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, a IllegalStateException will be thrown.
      Parameters:
      resource - the resource
      amount - the amount to transfer
      actor - the actor performing the transfer
      source - the source to extract from
      destination - the destination to insert to
      fallback - the fallback to insert leftovers in
      Returns:
      the amount transferred