In China's coal country, Shanxi Province, the black stuff is a more than just a source of income — it is a source of identity. Lumps of it are for sale at the national coal museum, in elegant, satin-lined gift boxes. The rest of the coal museum is faded and out of date, much like the city of Taiyuan, where it is located, about 300 miles southwest of Beijing.

The city of 4 million got rich off of coal, once, and became known as China's coal capital. Shanxi Province has a quarter of the nation's proven coal reserves. But now China is closing and consolidating its coal mines under state ownership — 25 have closed this year alone — and the region has not quite figured out how to rebound. The province produced 14.7 percent fewer tons of coal in 2016 from the previous year.

Despite the changing times, the coal museum's exhibition halls and simulated mine present a singular, unsubtle message: Coal is closely linked to China's success.

In a staged rain forest filled with roaring plastic animatronic dinosaurs, visitors are told (wrongly) that they died and were compacted under the earth's surface to become coal. A dramatic Mandarin voiceover in a low-tech eight-minute film informs the viewer that the history of coal mining in China is thousands of years old. The film is made in 4D, which means that the experience of the end of the Cretaceous Period is uncomfortable. The theater seats shake wildly as the earth is seen to be hit with a crater.

"We should cherish the hard-won treasure. Saving coal," the narrator intones.

A nearby display reads "comfort and community — life can't do without coal," featuring a photo of a SUV. This appears to go against government policy, as China has in fact moved to aggressively cut back petroleum-run cars, pushing to make 20 percent of the cars on China's roads electric-run by 2025.

The coal museum tour guide, a young woman in a fitted red coat, sticks to her pro-coal script: "In reality, not only transportation, but everything you wear — your clothes, your shoes — has to do with coal."

According to the International Energy Agency, at China's peak coal consumption from 2013 to 2014, it used about 4.2 billion tons of coal, accounting for half the world's coal consumption. Now, China is mining and using less coal. Energy experts were pleased to see that coal's share of China's total energy consumption fell by 2 percentage points to 62 percent in 2016 as the use of solar and other renewables rose.

Beijing is determined to embrace a shinier, new energy future and get its smothering pollution under control. It has moved 1 million coal workers out of the industry just in the last year, reducing their number to 4 million. Another million or so more are expected to lose their jobs by the year 2020, many in Shanxi, thanks to mine and plant closures.

Zheng Wenhai can see the industry shrinking around him. He is what's known as a "coal boss," a term that expresses the status to which some farmers in coal-rich areas rose after prospecting successfully for coal.

Wenhai set up a mining operation that employed as many as 300 people at its peak. He is a weathered, compact man. Although he recently lost a great deal of weight during an illness, he chain-smokes and has four different brands of cigarettes laid out on the table of his Taiyuan apartment.

Wenhai bought this spacious two-bedroom flat — the bare white walls of the living room lit with rainbow-colored spotlights — with profits from the sale of the mine. He sold it in 2008 for millions of dollars; soon after, the government seized it, and Wenhai has been suing his buyer ever since to try to get the rest of the cash he is owed.

In spite of all the difficulty, Wenhai got rich, and now owns multiple properties. To make money as a coal boss, he says he had to participate in a culture of corruption, shelling out bribes.

"Every coal boss has to do that," he says. "There will be dozens of bureaus that you need to respond to."

For decades, China's badly managed coal mining industry allowed corruption to fester, according to Alvin Lin, climate and energy policy director in Beijing for the Natural Resources Defense Council.

"There used to be no controls anywhere in China," he says. "The government is now observing standards in mines, environmental and otherwise, where the local small mines did not always do so."

The days of the freewheeling coal boss may be over. China is now in its third year of a self-declared " war on pollution," and while China's environment minister recently acknowledged that China faces "challenges" in managing air pollution, he promised to attain "the goal of building a 'Beautiful China' " by 2035.

Taiyuan just announced it has banned the sale, use and transport of coal for the winter season — except for large steel production plants or power plants — in an effort to limit the dense smog that fills the city during the cold months.

To fill the employment gap and try to find replacement jobs for former coal workers, China has promised to create 13 million renewable energy jobs, many of them in coal country. They are not yet much in evidence in Shanxi Province.

"Making the transition from coal is not going to be an overnight thing for parts of China whose entire economy was based on coal," says Lin.

In Shanxi, the provincial government has set up a development fund to aid the transition away from coal — by encouraging a tourist industry, for example. Tourism seems a more natural fit in the parts of the province that have ancient Buddhist grottoes, hanging temples and other sites.

The small coal mining town of Gujiao, on the other hand, has little to recommend it to visitors. Set in an industrial valley, train tracks wind across Gujao, transporting coal. Smokestacks rise up from mines and steel production facilities where work has slowed significantly, but not completely stopped.

In this unpromising landscape, one former coal boss decided to build a resort hotel. The Red Bean Mansion is a complex of red wooden villas, marked off by brightly painted traditional gates and hung with red Chinese lanterns. There are interconnecting courtyards, an orchard of pear trees, ponds with flowing fountains and some notable entertainment features: a pirate ship ride for kids and a ski slope, which the owner is working to lengthen.

The government helped subsidize construction, according to the manager of the resort, Shi Fei Wang, and also sends tour groups their way, which helps fill the resort during the summer months.

Still, the resort is barely breaking even. He says his whole town is struggling to adapt as the government shifts the economy away from coal.

His parents' business in town, a small taxi company, is faltering too, as the coal industry slows overall and the economy of the town stagnates. It will be a process to transition, he says. Like many people in Shanxi Province, he believes in China's larger goals for the environment and economy.

"China is just doing better and better," he says — even though there's little evidence that things are better for him.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.