The victim needed 22 stitches to his face after Garry Potts struck him with a glass without warning during the attack.
Leeds Crown Court heard the incident happened at a house in Featherstone in the early hours of October 21 last year.
Potts and his girlfriend had been invited to the property with others.
Dave Mackay, prosecuting, said the victim was sitting beside Potts’s girlfriend on a sofa shortly before the incident.
Potts said: “I need to separate you two before anything happens.”
The victim then went and sat on another sofa but Potts suddenly attacked him with the glass, which broke upon impact.
Potts then took off his shirt, picked up a knife and threatened to kill the victim.
Mr Mackay said the glass narrowly missed the victim’s eye.
The victim did not initially realise how serious his injury was but reported the incident to police the following day.
The court heard Potts tried to break into a house on Henderson Avenue, Normanton, while he was still wanted by police for the glass attack.
Potts, of Bosworth Avenue, Altofts, Wakefield, was arrested on December 29 at Pinderfields Hospital after being admitted with a broken leg.
He pleaded guilty to unlawful wounding and attempted burglary.
The court heard Potts has an “appalling” criminal record for violence.
At the time of the offences he was subject to a suspended sentence order for assaulting a 68-year-old man in Wakefield city centre.
The victim was pinned to the ground during the assault.
James Littlehales, mitigating, said Potts had little recollection of committing the offences and had pleaded guilty at an early stage.
Recorder Dafydd Enoch, QC, said: “It was a very unpleasant attack and resulted in a very unpleasant injury.
“It could have been a lot worse and it is lucky you are only facing sentence for unlawful wounding.”