pos.moveForwards(1.0);
TileEntity tile = world.getTileEntity((int) pos.x, (int) pos.y, (int) pos.z);
if (tile instanceof IPipeTile) {
IPipeTile pipe = (IPipeTile) tile;
if (pipe.getPipeType() != PipeType.ITEM) {
continue;
}
if (!pipe.isPipeConnected(side.getOpposite())) {
continue;
}
possiblePipes.add(pipe);
pipeDirections.add(side.getOpposite());
}
}
if (possiblePipes.size() > 0) {
int choice = RANDOM.nextInt(possiblePipes.size());
IPipeTile pipeEntry = possiblePipes.get(choice);
return pipeEntry.injectItem(stack, true, pipeDirections.get(choice));
}
return 0;
}