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:
parent
513388f6e3
commit
b46d1c33cc
6 changed files with 13 additions and 13 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,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;
|
||||||
|
|
||||||
|
@ -473,10 +473,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() {
|
||||||
|
@ -489,18 +489,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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue