Minecraft – Open to Lan automatically

minecraft-java-edition

My wife and I play minecraft together over our LAN. I always have to start up minecraft, start my Single Player game, select my world, then go and select to Open to LAN, and then Start LAN World. It's tedious, and sometimes I forget, causing my wife to be unable to see the "server", and prodding me to start it up.

I would like to automate the process. Is there a config file I can modify, or a batch script I can run that will always handle this process automatically? Worst case, what about a series of shortcut keys I can setup in a keyboard macro? Optimally, I'd be able to launch minecraft and start my world and have it immediately be open to LAN. Is this possible?

Best Answer

The proper way to do this is to host a server. If you're in the same local network (which a home network usually is), then it's pretty simple, you can skip most of the steps in the tutorial (archive) and just download the server, put it into a folder where you want to have all the server stuff, run it once with java -jar server.jar in a console (after switching to that folder with cd), change "eula=false" to "eula=true" in eula.txt to agree to the usage terms and you're done with the initial setup (and you can move your existing world there, modify settings, etc., if you want).
From then on you can always just start the server with the same java -jar server.jar command, which can be put into a desktop shortcut or similar, if you want.
On Windows, you can assing Ctrl+Alt+[key] key combinations to shortcuts, if you put them into the "all programs" folder of the start menu. On pretty much all Linux systems you can just bind keys to any console command directly.
When the server is running on a computer in the local network, it automatically appears in the "multiplayer" menu of Minecraft. You can also add it as one of the servers that are always in your list, that skips a few seconds of waiting until the server is discovered by your game.

The hacky way: You can automate clicking the buttons or running /publish using a click/keyboard macro. On Windows, I can recommend "TinyTask", on Linux "xdotool" or maybe "cnee", some people also like "AutoHotkey".