TileTank.getTanks() now returns a composite tank

This should fix tank triggers not working on BlockTank.
This commit is contained in:
CovertJaguar 2012-07-30 14:15:38 -07:00
parent eb735ec1f6
commit aaa35f0c5e

View file

@ -204,6 +204,27 @@ public class TileTank extends TileBuildCraft implements ITankContainer
@Override @Override
public ILiquidTank[] getTanks() public ILiquidTank[] getTanks()
{ {
return new ILiquidTank[]{tank}; ILiquidTank compositeTank = new LiquidTank(tank.getCapacity());
TileTank tile = getBottomTank();
if(tile != null && tile.tank.getLiquid() != null)
compositeTank.setLiquid(tile.tank.getLiquid().copy());
else
return new ILiquidTank[]{compositeTank};
tile = getTankAbove(tile);
while(tile != null){
if(tile.tank.getLiquid() == null || !compositeTank.getLiquid().isLiquidEqual(tile.tank.getLiquid()))
break;
compositeTank.getLiquid().amount += tile.tank.getLiquid().amount;
tile = getTankAbove(tile);
}
return new ILiquidTank[]{compositeTank};
} }
} }