Function move_resources
pub fn move_resources<R>(
host: &mut dyn ServerHost,
from: &Capability<dyn ResourceHandler<R>>,
to: &Capability<dyn ResourceHandler<R>>,
filter: impl Fn(&R) -> bool,
max: u32,
tx: &Transaction,
) -> Result<u32, Overanswered>Expand description
Moves up to max of what filter accepts out of from into wherever to takes it, index by
index from 0 (NeoForge’s ResourceHandlerUtil.move), in transaction tx: how much moved.
Each move is all or nothing, in a transaction of its own: what to won’t take stays in
from, and a move to takes only part of is tried again with that part (a cauldron gives
whole thirds). A handler answering more than it was asked has its move undone and ends the
moving with Overanswered.