Corrected add connections with old code

readded code from old steam pipes to pipe code too use a clean and
better pipe connection code. A lot easier to read and should check if it
can connect on weither or not that side does anything.
This commit is contained in:
Rseifert 2012-07-10 05:24:41 -04:00
parent 0ffc8eab65
commit 357ad64fd7

View file

@ -34,27 +34,20 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer
*/
public void addConnection(TileEntity tileEntity, byte side)
{
if(tileEntity instanceof TileEntityPipe)
this.connectedBlocks[side] = null;
if(tileEntity instanceof ILiquidConsumer)
{
if(((TileEntityPipe)tileEntity).getType() == this.getType())
if(((ILiquidConsumer)tileEntity).canRecieveLiquid(this.type, side))
{
this.connectedBlocks[side] = tileEntity;
}
else
}
if(tileEntity instanceof ILiquidProducer)
{
if(((ILiquidProducer)tileEntity).canProduceLiquid(this.type, side))
{
this.connectedBlocks[side] = null;
}
}
else
{
if(tileEntity instanceof ILiquidConsumer || tileEntity instanceof ILiquidProducer)
{
this.connectedBlocks[side] = tileEntity;
}
else
{
this.connectedBlocks[side] = null;
}
}
}
}