China warns it will retaliate against countries that cooperate with the U.S. in ways that hurt Beijing’s interests.