He discharged more shots in the air later.
The group took the gun off him and gave it back as they headed home. After walking off, he reloaded the gun and shot at his group of friends, who were following him, then reloaded and shot again as they sought cover behind a wheelie bin.
Mr Rouse-Henry screamed after being hit in the left knee and McLellan ran off and hid.
The victim had surgery to remove the pellet and had two weeks off work, Mr Hutton said.
The defendant told police he "got angry" and had no intention of hurting anyone.
Counsel Tim Cadogan said McLellan had just bought the gun that day. He had been "upset and extremely emotional" that evening for a number of reasons.
The group were "very good friends" and a non-association clause in McLellan's bail conditions meant he was not permitted to have any contact with them.
Mr Cadogan said that meant McLellan would miss several 18th and 20th birthday parties and asked if that clause could be removed but Judge Macdonald said it would remain.
All sentencing options remained on the table, Judge Macdonald said.