code: private int getConnections(IBlockAccess world, BlockPos pos, EnumFacing facing)
  	{
  		Block block = world.getBlockState(pos).getBlock();
  		int connection = 0;
  		for (int i = 0; i < 4; i++)
  		{
  			if (world.getBlockState(pos.offset(sides[facing.getIndex()][i])).getBlock() == block)
  				connection |= (1 << i);
  		}
  		return ~connection & 15;
  	}
docs: Determines the connections available at this position for the specified <b>side</b>.
  
  @param world the world
  @param pos the pos
  @param facing the facing
  @return the connections