Adjustments to Pipe Connection method to allow for proper sided checks (for correct liquid pipe support). Liquid pipes now query vs the correct side rather than UNKNOWN.

Signed-off-by: King Lemming <kinglemming@gmail.com>
This commit is contained in:
King Lemming 2013-01-09 19:12:56 -05:00
parent 513388f6e3
commit b46d1c33cc
6 changed files with 13 additions and 13 deletions

View file

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

View file

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

View file

@ -480,7 +480,7 @@ public class PipeTransportItems extends PipeTransport {
}
@Override
public boolean isPipeConnected(TileEntity tile) {
public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
return tile instanceof TileGenericPipe || tile instanceof IPipeEntry || tile instanceof ISpecialInventory
|| (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
public boolean isPipeConnected(TileEntity tile) {
public boolean isPipeConnected(TileEntity tile, ForgeDirection side) {
if (tile instanceof ITankContainer) {
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;
}

View file

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

View file

@ -458,7 +458,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
return null;
}
public boolean isPipeConnected(TileEntity with) {
public boolean isPipeConnected(TileEntity with, ForgeDirection side) {
Pipe pipe1 = pipe;
Pipe pipe2 = null;
@ -473,10 +473,10 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
&& !pipe1.transport.allowsConnect(pipe2.transport))
return false;
if (pipe2 != null && !(pipe2.isPipeConnected(this)))
if (pipe2 != null && !(pipe2.isPipeConnected(this, side)))
return false;
return pipe1 != null ? pipe1.isPipeConnected(with) : false;
return pipe1 != null ? pipe1.isPipeConnected(with, side) : false;
}
private void computeConnections() {
@ -489,18 +489,18 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
t.refresh();
if (t.getTile() != null) {
pipeConnectionsBuffer[i] = isPipeConnected(t.getTile());
pipeConnectionsBuffer[i] = isPipeConnected(t.getTile(), ForgeDirection.VALID_DIRECTIONS[i].getOpposite());
if (t.getTile() instanceof TileGenericPipe) {
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)
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);
scheduleRenderUpdate();
}