Um... because they were uniformed cops, they were not undercover. They were regular cops, in patrol cars, flashing lights and all, responding to a complaint made by a resident of the neighborhood.
And if the neighborhood residents are awake and calling 911 at 2am, that kind of undermines the "harmless fun" argument also.
Seriously, only a lifetime of mom and dad bailing you out of life's tricky situations would lead you to believe you can throw shit at uniformed cops with impunity.