use of network.rs485.logisticspipes.connection.LPNeighborTileEntityKt in project LogisticsPipes by RS485.
the class ModuleSatellite method spaceFor.
private int spaceFor(@Nonnull ItemStack stack, ItemIdentifier item, boolean includeInTransit) {
final IPipeServiceProvider service = Objects.requireNonNull(_service);
int count = service.getAvailableAdjacent().inventories().stream().map(neighbor -> LPNeighborTileEntityKt.sneakyInsertion(neighbor).from(getUpgradeManager())).map(LPNeighborTileEntityKt::getInventoryUtil).filter(Objects::nonNull).map(util -> util.roomForItem(stack)).reduce(Integer::sum).orElse(0);
if (includeInTransit) {
count -= service.countOnRoute(item);
}
return count;
}
Aggregations