diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index 495fceb..d2d1a8e 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -332,7 +332,7 @@ public class PipeNetwork implements ICapabilitySerializable, GraphL public int getItemsOnTheWay(BlockPos goalPipe, ItemStack type, ItemEqualityType... equalityTypes) { return this.getPipeItemsOnTheWay(goalPipe) - .filter(i -> ItemEqualityType.compareItems(i.stack, type, equalityTypes)) + .filter(i -> type == null || ItemEqualityType.compareItems(i.stack, type, equalityTypes)) .mapToInt(i -> i.stack.getCount()).sum(); } diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java index a195dc6..2a38546 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java @@ -148,17 +148,24 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide if (maxAmount < stack.getCount()) continue; if (preventOversending || maxAmount < Integer.MAX_VALUE) { + PipeNetwork network = PipeNetwork.get(this.world); // these are the items that are currently in the pipes, going to this pipe - int onTheWay = PipeNetwork.get(this.world).getItemsOnTheWay(this.pos, stack); + int onTheWay = network.getItemsOnTheWay(this.pos, null); if (onTheWay > 0) { - // check if any modules are limiting us - if (onTheWay + stack.getCount() > maxAmount) - continue; + if (maxAmount < Integer.MAX_VALUE) { + // these are the items on the way, limited to items of the same type as stack + int onTheWaySame = network.getItemsOnTheWay(this.pos, stack); + // check if any modules are limiting us + if (onTheWaySame + stack.getCount() > maxAmount) + continue; + } ItemStack copy = stack.copy(); copy.setCount(copy.getMaxStackSize()); // totalSpace will be the amount of items that fit into the attached container int totalSpace = 0; for (int i = 0; i < handler.getSlots(); i++) { + // this is an inaccurate check since it ignores the fact that some slots might + // have space for items of other types, but it'll be good enough for us ItemStack remain = handler.insertItem(i, copy, true); totalSpace += copy.getMaxStackSize() - remain.getCount(); }