When I want to invite my friends over the internet into my LAN world in Minecraft, I need to set my router to forward the port specified by Minecraft. As Mincraft picks a different port each time I open my world over LAN, I have to edit my router settings every time I want to start a multiplayer LAN session over the internet. Instead, I would like to set the router to the range of port numbers that Minecraft picks from.
What is the range of ports that Minecraft uses for LAN worlds?
So far, after four sessions, I have had ports between 49525 and 50852. I play the Java edition, if that makes any difference.
The port range must be coded into the Minecraft code. What file(s) would I look at to find it?