The partying teen whose legs were severed by a train in NSW's Hunter Valley has died in hospital.

Manning-Great Lakes police said he died on Boxing Day, three days after he was injured celebrating his 18th birthday.

Police are still trying to establish how he came to be on the train tracks at 4.30am, when he was struck by a train.

Both his legs were severed above the knee.

It is believed the teen was visiting Taree with his family.

Paramedics and police who attended the scene were assaulted by a group of people who threw rocks, forcing them to temporarily barricade themselves in the train driver's cabin.

The ambulance windscreen was also smashed and paramedics were shoved and assaulted.