Matthew Paul Byford, who was already on a suspended sentence, smashed the front door of Costa on Northgate in search of cash.
Prosecutor Jade Edwards told Leeds Crown Court that the burglary happened at around 11.30pm on September 3 last year, and was all captured on CCTV.
Byford was seen to empty the tips cup, then tried to break open a charity box. He then took a soft drink and leave.
The bottle was found a short time later outside the premises and forensically linked Byford.
The 32-year-old was arrested a short time later, wearing the same coat seen on the CCTV.
He told police somebody had just given him the jacket, but gave no comments during his interview.
He later admitted a charge of burglary.
The cost to the damage of the window was £500, and the value of the items he took came to £11.80.
The court was told that Byford was already subject to a 21-month jail term, suspended for 24 months, from last year, when he was convicted of having a dangerous dog out of control.
He appeared at Leeds Crown Court in November last year in relation to the Costa break-in, but was told by Judge Penelope Belcher that she would give him a chance to tackle his addiction to heroin, cocaine and cannabis, and deferred sentencing for six months.
The court was told this week that he had since enrolled in a detox programme in Manchester, but was kicked out after he left to take drugs.
He then sought help from Turning Point in Wakefield and was now making progress, according to his barrister, Stephen Welford.
Mr Welford said he had since moved into supported living in Hyde Park House in Eastmoor, and was receiving monthly injections rather than daily does of the prescription heroin substitute, methadone.
However, he admitted that Byford was still taking cocaine and cannabis regularly.
Mr Welford said: "He is still doing well. It's not perfect and not ideal, but he seems to have conquered his initial difficulties."
Judge Belcher told Byford: "It's a fine balance but I have come to the conclusion that things are moving in a positive direction."
She gave him a 12-month community order, but warned him that the suspended sentence still remains in place.
She said: "If you come back in front of me with anything serious, you will go into custody, no matter how much progress you have made.
"You can't keep offending like this.
"You might think I'm a nice judge but be aware, I'm as tough as any judge.
"I'm not a soft touch, I'm doing my best to assist you.
"I'm not afraid to lock people up."