Keep in mind that although the Chinese like to consider the Yellow sea to be their playground, and can be trusted to support their client and ally North Korea, to go to war with the U S would be highly destructive to their country even if that war occurs solely in Korea.
That is because they are dependent for food and fuel on their trade with the rest of the world, and those trade routes are long and vulnerable. In a shooting war with the U S, they could count on that trade coming to a quick end, as the U S still has massive clout with the rest of China's trading partners and can put huge pressure on them to cut the Chinese off. Even without the cooperation of the rest of the world, the US could militarily cut off China's trade without too much trouble. If this occurred there would be immediate shortages of food and fuel, which would put a quick choke hold on the Chinese economy, not to mention their war making ability.
This the Chinese are well aware of.
We don't normally think of China as a fragile state, but the odd co existence of capitalism and communism there is in fact necessary for the Communists to stay in power. Without the ability to keep most of their population employed, the Communists know that revolution would occur, and they would all go the way of Nicolai Ceaucescu. Even now, in the best of times for the Chinese government, there are frequent strikes and acts of civil unrest across the land, which for now are easy for the authorities to control, but would not be if the scale of these disturbances were to increase. Remember that they barely survived the Tien An Men Square protests, which was only brought under control with the brute force of soldiers and tanks. The leaders of China know that their authority to govern comes not from the consent of the governed, but from the barrel of a gun. They also well know that unless they satisfy the rising expectations of the people, that brute force will avail them nothing, and they will be thrown out and replaced suddenly. Those aspirations would with certainly be rudely dashed, perhaps permanently, due to the economic consequences of a war with the US.
While a war would bring the Chinese people together patriotically for a while, it would, at the very least, hugely impact the mercantilist economy in China for the worst, and could in fact easily bring the economy to it's quick destruction if their trade with the rest of the world grinds to a halt. Don't even consider the effect if the US decides, during a Chinese war, to cancel China's treasury bonds! There is nothing like smell of a trillion plus in dollar equity going up in the smoke of war with one of your biggest trading partners!
The Chinese are well aware of all this.
Finally, there is no guarantee that they could win even a conventional war with the U S, let alone one that goes nuclear due to the crazy desperate acts of their client state. In China, to lose a conventional war in their backyard to the U S would be a loss of face so severe that this alone could fatally damage the Communist government.
So in summary, and recognizing that nothing is guaranteed except that the unexpected will always happen sooner or later, there is very little to gain, and that at great risk, for the Chinese in a war with the U S. What China is now really is a creation of their economic interconnectedness with the rest of the world, and there really is no going back to an earlier existence. We should hope that they are making that very clear to the North Koreans right now.