I’ve been waiting for veteran sitcom “Modern Family” to finally flip its script from clever to annoying.

And now it’s happened.

This week’s Christmas episode — with a plotline painfully contorting itself into an homage to “The Shining” — was too cute by half, a forced, charmless whiff for a series that has, since Day One, largely retained its freshness with clever writing and lovable (believable) characters.

I’m surprised, in fact, that it’s taken “Modern Family” this long to jump the proverbial shark. You’d think a show constructed around farce would have long ago worn out its welcome (as so often happens).

But now that it’s reached its seventh season — always a danger zone for any veteran series — “Modern Family” seems to be running on fumes. Yes, the demand to produce 22 episodes each season is daunting, and no one expects every single episode (of any sitcom or drama) to hit a home run each week. That would be ludicrous. Even TV’s classics produced their share of clunkers and tried too hard, usually late in the game, to rekindle their original magic.

(Many episodes of “Seinfeld,” following creator Larry David’s departure, obsessively trotted out catchphrases — “anti-dentite” was one — trying to ape David’s style a la “close talker,” “double dipping,” et al. It was obvious and annoying.)

So what was once charming about “Modern Family” is now just predictable. If Wednesday’s episode is indicative of what’s to come, “MF” has lost its way — and its mojo. (But not its viewership — it’s still ABC’s highest-rated sitcom.) We know, by now, that there’s going to be a theme in each episode and, most likely, allusions to pop-culture touchstones. Again. Once upon a time — early in the show’s run — it was funny and original when Cam (Eric Stonestreet), wearing a white T-shirt, shouted “Stella!” while searching for Jay’s (Ed O’Neill) errant French bulldog in a nod to “A Streetcar Named Desire.”

Or when Mitchell (Jesse Tyler Ferguson) scolded an affected Cam on a trip to Disneyland (with their daughter, Lily) during the initial “Downton Abbey” craze: “It’s ‘Toontown,’ not ‘Toonton.’”

But Wednesday’s homage to “The Shining” — Stanley Kubrick’s 1980 chiller about madness overtaking the caretaker (Jack Nicholson) of a spooked, isolated, snowed-in hotel — was over-the-top, even by “Modern Family” standards. (Including a subplot in which college freshman Alex, played by Ariel Winter, encountered her own Ghost of Christmas Future in guest star Andrea Martin, playing an unwanted cabin guest).

In the episode, Gloria (Sofía Vergara) gets the entire family together for Christmas in a remote cabin in the California mountains, hoping for a snowy celebration. (Naturally she miscalculates the weather, since her cellphone was set to Celsius. So it’s brutally hot.)

Fair enough. Many “Modern Family” plots revolve around family get-togethers, so this was nothing unusual. But once the writers dialed up the visual references to “The Shining” (remote cabin, get it?), the smugness factor set in. There was Lily (Aubrey Anderson-Emmons), riding her Big Wheel-type trike around the cabin’s hallways — the camera tracking her as it did Danny (Danny Lloyd) in the movie — where she encounters the emotionless Luke (Nolan Gould) and Manny (Rico Rodriguez) standing side by side in the hallway wearing matching blue sweaters (like the creepy identical-twin girls who wear matching blue outfits in the movie).

And there were Luke and Manny trying to scare Lily by telling her about what horrors lay behind a closed cabin door. All that was missing was a “redrum” reference. (Who knows — maybe it was there and I missed it.)

If this is the beginning of the end for “Modern Family” — that point where you don’t care if you miss an episode, because they’re all the same anyway — then it can look back, proudly, over its long, distinguished run (it premiered in 2009). There’s nothing sadder, in TV series terms, than a show running on fumes.

No one wants to see that.