A pipe for smoking cannabis was on his bedside table, and a "snuff bullet'' for sniffing cocaine was on the dressing table.
The defendant's counsel, Bill Dawkins, said his client suffered from "massive pain'' as a result of twice breaking his neck.
He took about 1200 painkillers a month to deal with his pain, but they were "not doing it''.
He was a heavy user of cannabis for "medicinal purposes'', but the other drugs in the house were "odds and sods'' left behind by visitors.
The defendant had bought the AR15 legally with his category A firearms licence, Dawkins said. But he later bought the 30-round magazine on the internet, unaware it made the rifle illegal for that licence category.
Although "ignorance of the law excuses no-one'', it was a mitigating factor.
Judge John Brandts-Giesen said he had decided "by a narrow margin'' to grant a discharge without conviction on the grounds the consequences of a conviction would outweigh the seriousness of the offending.
The possession of the AR15 was the most serious charge, but the defendant's explanation was at least partly accepted by the police prosecutor.
He had used it for hunting and to put down deer on a farm, and, like many people, had exploited a "well-known gap in the law'' to pair it with a high-capacity magazine.
In relation to the drugs, an anaesthetist's report stated the defendant was "far better'' when regularly using cannabis, and a legal cannabis substitute was very expensive.
It had been "unwise'' of him to keep the other drugs, which had been given to him by a visitor.
The defendant was "overcoming great odds in order to work'' but by possessing illegal drugs faced the risk of being convicted in the future.
"Section 106 discharges are not given liberally to people, particularly not in a case of reoffending.''
He ordered the destruction of the firearm and the drugs.
The defendant's arrest preceded recent law changes, resulting from the Christchurch mosque shootings in March, which ban military-style semi-automatic rifles and high-capacity magazines.