Saving rainwater in barrels or tanks in California is not really illegal as in collecting and saving the water that rains over your yard or house.
You can catch all the rainwater you want that comes from the sky and comes off your roof without getting into trouble.
What is illegal though is blocking or damming up creeks and streams and collecting all the water in the creek or streams and not letting the creeks and streams run and flow freely.
So if you have a creek or stream in your yard you cannot block it and use all the water for yourself as you have to let it flow naturally like it's supposed too.
But just catching rainwater and saving that rainwater that comes off your roof and from the sky is perfectly legal.