diff --git a/common/buildcraft/robotics/DockingStationPipe.java b/common/buildcraft/robotics/DockingStationPipe.java index eb4685df..2af0a8c2 100644 --- a/common/buildcraft/robotics/DockingStationPipe.java +++ b/common/buildcraft/robotics/DockingStationPipe.java @@ -14,11 +14,12 @@ import buildcraft.api.robots.RobotManager; import buildcraft.api.statements.StatementSlot; import buildcraft.api.transport.IInjectable; import buildcraft.api.transport.IPipeTile; -import buildcraft.core.lib.inventory.InventoryConcatenator; import buildcraft.transport.Pipe; import buildcraft.transport.PipeTransportItems; import buildcraft.transport.TravelingItem; import buildcraft.transport.gates.ActionIterator; +import buildcraft.transport.pipes.PipeFluidsWood; +import buildcraft.transport.pipes.PipeItemsWood; public class DockingStationPipe extends DockingStation { @@ -85,30 +86,45 @@ public class DockingStationPipe extends DockingStation { @Override public IInventory getItemInput() { - InventoryConcatenator inv = InventoryConcatenator.make(); - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - TileEntity nearbyTile = getPipe().getWorld().getTileEntity(x() + dir.offsetX, - y() + dir.offsetY, z() + dir.offsetZ); - if (nearbyTile instanceof IInventory) { - inv = inv.add((IInventory) nearbyTile); - } - } - if (inv.getSizeInventory() > 0) { - return inv; - } else { + if (getPipe().getPipeType() != IPipeTile.PipeType.ITEM) { return null; } + + if (!(getPipe().getPipe() instanceof PipeItemsWood)) { + return null; + } + + int meta = ((TileEntity) getPipe()).getBlockMetadata(); + ForgeDirection dir = ForgeDirection.getOrientation(meta); + + TileEntity connectedTile = getPipe().getWorld().getTileEntity(x() + dir.offsetX, + y() + dir.offsetY, z() + dir.offsetZ); + if (connectedTile instanceof IInventory) { + return (IInventory) connectedTile; + } + + return null; } @Override public IFluidHandler getFluidInput() { - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - TileEntity nearbyTile = getPipe().getWorld().getTileEntity(x() + dir.offsetX, - y() + dir.offsetY, z() + dir.offsetZ); - if (nearbyTile instanceof IFluidHandler) { - return (IFluidHandler) nearbyTile; - } + if (getPipe().getPipeType() != IPipeTile.PipeType.FLUID) { + return null; } + + if (!(getPipe().getPipe() instanceof PipeFluidsWood)) { + return null; + } + + int meta = ((TileEntity) getPipe()).getBlockMetadata(); + ForgeDirection dir = ForgeDirection.getOrientation(meta); + + TileEntity connectedTile = getPipe().getWorld().getTileEntity(x() + dir.offsetX, + y() + dir.offsetY, z() + dir.offsetZ); + if (connectedTile instanceof IFluidHandler) { + return (IFluidHandler) connectedTile; + } + return null; } @@ -118,7 +134,7 @@ public class DockingStationPipe extends DockingStation { return null; } - return (IFluidHandler) getPipe(); + return (IFluidHandler) ((Pipe) getPipe().getPipe()).transport; } @Override diff --git a/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java b/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java index 00062eee..ff3fa713 100755 --- a/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java @@ -35,7 +35,6 @@ public class AIRobotUnloadFluids extends AIRobot { if (unload(robot, robot.getDockingStation(), true) == 0) { terminate(); } else { - waitedCycles = 0; setSuccess(true); } } diff --git a/common/buildcraft/robotics/statements/RobotsActionProvider.java b/common/buildcraft/robotics/statements/RobotsActionProvider.java index cde4e940..66a21a6b 100755 --- a/common/buildcraft/robotics/statements/RobotsActionProvider.java +++ b/common/buildcraft/robotics/statements/RobotsActionProvider.java @@ -73,11 +73,11 @@ public class RobotsActionProvider implements IActionProvider { continue; } - if (station.getItemOutput() != null) { + if (station.getItemInput() != null) { result.add(BuildCraftRobotics.actionStationProvideItems); } - if (station.getFluidOutput() != null) { + if (station.getFluidInput() != null) { result.add(BuildCraftRobotics.actionStationProvideFluids); }