Class Transfers

java.lang.Object
fr.robie.machineengine.api.transfer.Transfers

public final class Transfers extends Object
Transfer helpers built on ResourceHandlers and nested transactions.
  • Method Details

    • move

      @NotNull public static @NotNull TransferResult move(@NotNull @NotNull ResourceHandler source, @NotNull @NotNull ResourceHandler target, @NotNull @NotNull Predicate<ResourceVariant> filter, long maxAmount, @NotNull @NotNull TransactionContext transaction)
      Moves up to maxAmount of variants matching filter from source to target inside transaction. Each variant moves in its own nested transaction, so a misbehaving handler can never lose or create resources.
    • simulateInsert

      public static long simulateInsert(@NotNull @NotNull ResourceHandler handler, @NotNull @NotNull ResourceVariant variant, long maxAmount, @NotNull @NotNull TransactionContext transaction)
      Returns:
      how much handler would accept, without changing it