Pipes connecting improperly (fix of my last PR)

1) Pipes now properly check if IPipeConnection allows the connection.

2) Items pipes should no longer connect to ISideInventory sides where getSizeInventory <= 0.
This allows third-party modders to prevent pipes connection to their machines without having to depend on BC's IPipeConnection.

3) Improved the routing mechanism for piped items. 
Now it's properly checked if the input is accepted, before trying to send it there.

4) Fixes the bug my previous PR generated.
This commit is contained in:
Xhamolk 2012-10-04 17:05:11 -06:00
parent 5885f08fab
commit 76adffe05c

View file

@ -16,6 +16,7 @@ import java.util.Random;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.Orientations;
import buildcraft.api.core.Position;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.api.gates.Action;
import buildcraft.api.gates.ActionManager;
@ -26,6 +27,7 @@ import buildcraft.api.gates.ITriggerParameter;
import buildcraft.api.gates.Trigger;
import buildcraft.api.gates.TriggerParameter;
import buildcraft.api.transport.IPipe;
import buildcraft.api.transport.IPipeConnection
import buildcraft.core.IDropControlInventory;
import buildcraft.core.network.TilePacketWrapper;
import buildcraft.core.triggers.ActionRedstoneOutput;
@ -131,6 +133,11 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
}
public boolean isPipeConnected(TileEntity tile) {
if( tile instanceof IPipeConnection && !(tile instanceof TileGenericPipe) ){
Orientations or = Utils.get3dOrientation(new Position(this.container), new Position(tile));
if( !((IPipeConnection) tile).isPipeConnected(or) )
return false;
}
return logic.isPipeConnected(tile) && transport.isPipeConnected(tile);
}