use of logisticspipes.interfaces.routing.IFilter in project LogisticsPipes by RS485.
the class ModuleProvider method getAllItems.
@Override
public void getAllItems(Map<ItemIdentifier, Integer> items, List<IFilter> filters) {
IInventoryUtil inv = _service.getPointedInventory(_extractionMode, true);
if (inv == null) {
return;
}
Map<ItemIdentifier, Integer> currentInv = inv.getItemsAndCount();
//Skip already added items from this provider, skip filtered items, Reduce what has been reserved, add.
outer: for (Entry<ItemIdentifier, Integer> currItem : currentInv.entrySet()) {
if (items.containsKey(currItem.getKey())) {
// Already provided by the previous module
continue;
}
if (!filterAllowsItem(currItem.getKey())) {
continue;
}
for (IFilter filter : filters) {
if (filter.isBlocked() == filter.isFilteredItem(currItem.getKey().getUndamaged()) || filter.blockProvider()) {
continue outer;
}
}
int remaining = currItem.getValue() - _service.getItemOrderManager().totalItemsCountInOrders(currItem.getKey());
if (remaining < 1) {
continue;
}
items.put(currItem.getKey(), remaining);
}
}
Aggregations