Paul Malcolm Priest, 39, of Moor Street, admitted attempted theft when he appeared before magistrates on Wednesday.
The court heard Priest broke into the car on Highfield Way while the owner was watching Mansfield Town FC play at home on September 3.
Nothing was taken and the owner handed police a shard of glass with Priest’s blood on it which they used to track him down.
Priest told police he planned to sell whatever he could steal to buy electricity.
The offence put him in breach of a 12 month conditional discharge, imposed on January 14 for possession of heroin and shop theft.
Donna Pursglove, mitigating, said: “Mr Priest is no stranger to these courts but in most recent years his offending has reduced somewhat.
“He has struggled with alcohol and drug addiction. He has been homeless on and off for the last 15 years.”
Cheryl Nisbet, of the probation service, said: “He passed the car and saw a phone cable and assumed there was a phone there, but there wasn’t and he came away with nothing.”
He takes subutex, she said, but also admitted to injecting amphetamine and using cannabis.
Magistrates imposed a 12 month community order with six days of a rehabilitation activity requirement and a six month drug rehabilitation requirement.
He was also ordered to pay £75 compensation, an £85 victim surcharge and £85 court costs.