station.y()
+ dir.offsetY, station.z() + dir.offsetZ);
if (nearbyTile != null && nearbyTile instanceof IInventory) {
IInventory tileInventory = (IInventory) nearbyTile;
ITransactor robotTransactor = Transactor.getTransactorFor(robot);
for (IInvSlot slot : InventoryIterator.getIterable(tileInventory, dir.getOpposite())) {
ItemStack stack = slot.getStackInSlot();
if (stack != null) {
if (ActionRobotFilter.canInteractWithItem(station, filter, ActionStationProvideItems.class)
&& filter.matches(stack)) {
ITransactor t = Transactor.getTransactorFor(robot);
if (quantity == -1) {
ItemStack added = t.add(slot.getStackInSlot(), ForgeDirection.UNKNOWN, true);
slot.decreaseStackInSlot(added.stackSize);
return;
} else {
ItemStack toAdd = slot.getStackInSlot().copy();
if (toAdd.stackSize >= quantity) {
toAdd.stackSize = quantity;
}
ItemStack added = t.add(toAdd, ForgeDirection.UNKNOWN, true);
slot.decreaseStackInSlot(added.stackSize);
return;
}
}
}