About 6pm, Pekamu returned. He had been drinking all day and was angry about not being given food the night before.
The 18-year-old produced a large machete, which he had hidden under his clothing, and started waving it around while demanding free food.
A customer and the shop's owner managed to flee, but the man Pekamu had previously approached was cornered and feared for his safety.
Pekamu helped himself to a pie, some chips and lollies, but not before turning his machete on a cooking vat, extractor fan and kitchen door.
He was arrested by police as he walked out of the shop.
Pekamu's lawyer, Stephen Ross, said his client had starting drinking and taking drugs at 14.
When Pekamu was intoxicated, he lost the ability to think and act rationally, Mr Ross said.
Pekamu had always lived in the Ohakune and Raetihi areas, except for a year in Auckland, and had been doing so virtually independently since turning 16.
In a victim impact statement, the shop's owner, Mary, said Pekamu had been a frequent customer of the takeaway bar and had never previously been any trouble. She described the incident as a nightmare, adding that she had never seen Pekamu like that before.
Judge Behrens told Pekamu before he was led away that he must do something about his use of alcohol and violence, otherwise he would end up in the same place.