How much spare memory does your computer/laptop have and how much RAM can it access? If both are too low then that might be the problem, especially if you start lagging/freezing really hard before disconnection.
Alternatively (Although unlikely) it could be related to your graphics card, but it'd have to be like fried for that to happen.
Question: whether it's minigames or survival, singleplayer or servers whenever fireworks go off MC freezes and crashes plz help me
Alternatively (Although unlikely) it could be related to your graphics card, but it'd have to be like fried for that to happen.