After weeks of intense negotiation, state lawmakers on Friday reached a compromise on legislation to regulate energy use by California’s growing data center industry, action triggered by community anger over the facilities and fears of high utility bills in some communities.