fixed single-pipe networks not allowing items through

This commit is contained in:
Ellpeck 2020-05-09 21:35:34 +02:00
parent def337be85
commit 9d29ed53c0

View file

@ -143,15 +143,13 @@ public class PipeNetwork implements ICapabilitySerializable<CompoundNBT>, GraphL
return false; return false;
this.startProfile("find_destination"); this.startProfile("find_destination");
for (BlockPos pipePos : this.getOrderedNetworkNodes(startPipePos)) { for (BlockPos pipePos : this.getOrderedNetworkNodes(startPipePos)) {
if (pipePos.equals(startPipePos))
continue;
PipeTileEntity pipe = this.getPipe(pipePos); PipeTileEntity pipe = this.getPipe(pipePos);
BlockPos dest = pipe.getAvailableDestination(stack, false, preventOversending); BlockPos dest = pipe.getAvailableDestination(stack, false, preventOversending);
if (dest != null) { if (dest == null || dest.equals(startInventory))
continue;
this.endProfile(); this.endProfile();
return this.routeItemToLocation(startPipePos, startInventory, pipe.getPos(), dest, itemSupplier); return this.routeItemToLocation(startPipePos, startInventory, pipe.getPos(), dest, itemSupplier);
} }
}
this.endProfile(); this.endProfile();
return false; return false;
} }
@ -191,7 +189,7 @@ public class PipeNetwork implements ICapabilitySerializable<CompoundNBT>, GraphL
} }
public ItemStack requestItem(NetworkLocation location, BlockPos destPipe, BlockPos destInventory, ItemStack stack, ItemEqualityType... equalityTypes) { public ItemStack requestItem(NetworkLocation location, BlockPos destPipe, BlockPos destInventory, ItemStack stack, ItemEqualityType... equalityTypes) {
if (location.pipePos.equals(destPipe)) if (location.getPos().equals(destInventory))
return stack; return stack;
ItemStack remain = stack.copy(); ItemStack remain = stack.copy();
for (int slot : location.getStackSlots(this.world, stack, equalityTypes)) { for (int slot : location.getStackSlots(this.world, stack, equalityTypes)) {