Search in sources :

Example 1 with LPNeighborTileEntityKt

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;
}
Also used : Objects(java.util.Objects) ItemStack(net.minecraft.item.ItemStack) SinkReply(logisticspipes.utils.SinkReply) List(java.util.List) FixedPriority(logisticspipes.utils.SinkReply.FixedPriority) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) LPNeighborTileEntityKt(network.rs485.logisticspipes.connection.LPNeighborTileEntityKt) IPipeServiceProvider(logisticspipes.interfaces.IPipeServiceProvider) Property(network.rs485.logisticspipes.property.Property) NotNull(org.jetbrains.annotations.NotNull) Collections(java.util.Collections) Nonnull(javax.annotation.Nonnull) IPipeServiceProvider(logisticspipes.interfaces.IPipeServiceProvider) LPNeighborTileEntityKt(network.rs485.logisticspipes.connection.LPNeighborTileEntityKt)

Aggregations

Collections (java.util.Collections)1 List (java.util.List)1 Objects (java.util.Objects)1 Nonnull (javax.annotation.Nonnull)1 IPipeServiceProvider (logisticspipes.interfaces.IPipeServiceProvider)1 SinkReply (logisticspipes.utils.SinkReply)1 FixedPriority (logisticspipes.utils.SinkReply.FixedPriority)1 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)1 ItemStack (net.minecraft.item.ItemStack)1 LPNeighborTileEntityKt (network.rs485.logisticspipes.connection.LPNeighborTileEntityKt)1 Property (network.rs485.logisticspipes.property.Property)1 NotNull (org.jetbrains.annotations.NotNull)1