Class Transfers
java.lang.Object
fr.robie.machineengine.api.transfer.Transfers
Transfer helpers built on
ResourceHandlers and nested transactions.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull TransferResultmove(@NotNull ResourceHandler source, @NotNull ResourceHandler target, @NotNull Predicate<ResourceVariant> filter, long maxAmount, @NotNull TransactionContext transaction) Moves up tomaxAmountof variants matchingfilterfromsourcetotargetinsidetransaction.static longsimulateInsert(@NotNull ResourceHandler handler, @NotNull ResourceVariant variant, long maxAmount, @NotNull TransactionContext transaction)
-
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 tomaxAmountof variants matchingfilterfromsourcetotargetinsidetransaction. 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
handlerwould accept, without changing it
-