MCPcopy Create free account
hub / github.com/boxbeam/RedLib / countAndRemove

Method countAndRemove

src/redempt/redlib/itemutils/ItemUtils.java:454–459  ·  view source on GitHub ↗

Remove all matching items up to a maximum, returning the number that were removed @param inv The inventory to count and remove items from @param item The item to count and remove @param max The maximum number of items to remove @param comparison A filter to compare items for cou

(Inventory inv, ItemStack item, int max, BiPredicate<ItemStack, ItemStack> comparison)

Source from the content-addressed store, hash-verified

452 * @return How many items were removed
453 */
454 public static int countAndRemove(Inventory inv, ItemStack item, int max, BiPredicate<ItemStack, ItemStack> comparison) {
455 int count = count(inv, item, comparison);
456 count = Math.min(max, count);
457 remove(inv, item, count, comparison);
458 return count;
459 }
460
461 /**
462 * Remove all matching items up to a maximum, returning the number that were removed

Callers

nothing calls this directly

Calls 3

countMethod · 0.95
removeMethod · 0.95
compareMethod · 0.95

Tested by

no test coverage detected