Merge pull request #559 from KingLemming/master

Pipe Connection fixes
This commit is contained in:
SirSengir 2013-01-10 03:03:37 -08:00
commit bc2e7bacda
6 changed files with 13 additions and 13 deletions

View file

@ -130,8 +130,8 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
updateSignalState(); updateSignalState();
} }
public boolean isPipeConnected(TileEntity tile) { public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
return logic.isPipeConnected(tile) && transport.isPipeConnected(tile); return logic.isPipeConnected(tile) && transport.isPipeConnected(tile, side);
} }
/** /**

View file

@ -49,7 +49,7 @@ public abstract class PipeTransport {
this.container = tile; this.container = tile;
} }
public boolean isPipeConnected(TileEntity tile) { public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
return true; return true;
} }

View file

@ -480,7 +480,7 @@ public class PipeTransportItems extends PipeTransport {
} }
@Override @Override
public boolean isPipeConnected(TileEntity tile) { public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
return tile instanceof TileGenericPipe || tile instanceof IPipeEntry || tile instanceof ISpecialInventory return tile instanceof TileGenericPipe || tile instanceof IPipeEntry || tile instanceof ISpecialInventory
|| (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0) || (tile instanceof IMachine && ((IMachine) tile).manageSolids()); || (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0) || (tile instanceof IMachine && ((IMachine) tile).manageSolids());
} }

View file

@ -491,11 +491,11 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
} }
@Override @Override
public boolean isPipeConnected(TileEntity tile) { public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
if (tile instanceof ITankContainer) { if (tile instanceof ITankContainer) {
ITankContainer liq = (ITankContainer) tile; ITankContainer liq = (ITankContainer) tile;
if (liq.getTanks(ForgeDirection.UNKNOWN) != null && liq.getTanks(ForgeDirection.UNKNOWN).length > 0) if (liq.getTanks(side) != null && liq.getTanks(side).length > 0)
return true; return true;
} }

View file

@ -58,7 +58,7 @@ public class PipeTransportPower extends PipeTransport {
SafeTimeTracker tracker = new SafeTimeTracker(); SafeTimeTracker tracker = new SafeTimeTracker();
@Override @Override
public boolean isPipeConnected(TileEntity tile) { public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
return tile instanceof TileGenericPipe || tile instanceof IMachine || tile instanceof IPowerReceptor; return tile instanceof TileGenericPipe || tile instanceof IMachine || tile instanceof IPowerReceptor;
} }

View file

@ -462,7 +462,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
return null; return null;
} }
public boolean isPipeConnected(TileEntity with) { public boolean isPipeConnected(TileEntity with, ForgeDirection side) {
Pipe pipe1 = pipe; Pipe pipe1 = pipe;
Pipe pipe2 = null; Pipe pipe2 = null;
@ -477,10 +477,10 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
&& !pipe1.transport.allowsConnect(pipe2.transport)) && !pipe1.transport.allowsConnect(pipe2.transport))
return false; return false;
if (pipe2 != null && !(pipe2.isPipeConnected(this))) if (pipe2 != null && !(pipe2.isPipeConnected(this, side)))
return false; return false;
return pipe1 != null ? pipe1.isPipeConnected(with) : false; return pipe1 != null ? pipe1.isPipeConnected(with, side) : false;
} }
private void computeConnections() { private void computeConnections() {
@ -493,18 +493,18 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
t.refresh(); t.refresh();
if (t.getTile() != null) { if (t.getTile() != null) {
pipeConnectionsBuffer[i] = isPipeConnected(t.getTile()); pipeConnectionsBuffer[i] = isPipeConnected(t.getTile(), ForgeDirection.VALID_DIRECTIONS[i].getOpposite());
if (t.getTile() instanceof TileGenericPipe) { if (t.getTile() instanceof TileGenericPipe) {
TileGenericPipe pipe = (TileGenericPipe) t.getTile(); TileGenericPipe pipe = (TileGenericPipe) t.getTile();
pipe.pipeConnectionsBuffer[ForgeDirection.values()[i].getOpposite().ordinal()] = pipeConnectionsBuffer[i]; pipe.pipeConnectionsBuffer[ForgeDirection.VALID_DIRECTIONS[i].getOpposite().ordinal()] = pipeConnectionsBuffer[i];
} }
} }
} }
for (int i = 0; i < tileBuffer.length; ++i) for (int i = 0; i < tileBuffer.length; ++i)
if (oldConnections[i] != pipeConnectionsBuffer[i]) { if (oldConnections[i] != pipeConnectionsBuffer[i]) {
Position pos = new Position(xCoord, yCoord, zCoord, ForgeDirection.values()[i]); Position pos = new Position(xCoord, yCoord, zCoord, ForgeDirection.VALID_DIRECTIONS[i]);
pos.moveForwards(1.0); pos.moveForwards(1.0);
scheduleRenderUpdate(); scheduleRenderUpdate();
} }