How to remove items
Best-effort remove — remove what’s available
When you attempt to remove more items than a container actually holds, best-effort mode removes as many as it can rather than failing. For example, if your “backpack” contains 5 “iron_ingot” and you request a best-effort removal of 8, the operation succeeds by removing all 5 available and reports that 5 out of 8 requested were removed, leaving the quantity of “iron_ingot” at 0.
Exact remove — fail if insufficient quantity
When you attempt to remove more items than a container holds using exact mode, the operation fails safely. For example, if your “backpack” (with a soft weight constraint of 100.0) contains 5 “iron_ingot” and you try to remove 8 in exact mode, the removal is rejected with an insufficient quantity error and the container retains all 5 ingots unchanged.
Remove clears a previously exceeded threshold
When your container has weight-based thresholds configured, removing items can clear previously exceeded thresholds. For example, if your “backpack” has a soft weight limit of 100.0 with an “encumbered” threshold at 70% capacity, and it contains 8 iron ingots, removing 3 of them in exact mode successfully removes all 3 requested items. This brings the total weight down to 50.0, which falls below the 70% threshold, so the operation reports that the “encumbered” threshold has been cleared.
Generated from core/tests/features/remove.feature