Closed MelonHell closed 1 year ago
Hmm, it would probably not be trivial. I am far from an expert on this but here are some thoughts I had:
The easiest thing that comes to mind is Display.addParent(java.awt.Canvas). But there are some problems with this. Most launchers start Minecraft in a separate process and theres not really a way to share a Canvas instance between those. Starting Minecraft in the same Java Process is possible, but then you are running into the problem that different Minecraft versions use different Java versions.
Maybe some native solution with C/C++ code is possible but thats something I have no experience with. Maybe someone else already thought about a way to use a single window for different processes. I think this is where I would start my research.
Some dumb ideas:
Now a hilarious idea could be to use something similar to the redirection in headlessmc-lwjgl to, instead of rendering in the child process, communicate every lwjgl call made in the child process back to the launcher process (e.g. via sockets) and then just execute those calls there. Maybe theres a smart way to share the Buffers between the processes, but this is probably very bad for performance and not worth pursuing.
Another really bad idea: you could interpret Minecraft directly in the launcher process, that way you dont have to deal with a second process. Could be done by forking a JVM and making the launcher control it. Sharing a Window within that process should be possible, but JVMs are big and complicated and again, different Minecraft versions use different Java versions.
Thanks for the advice. This will help in research.
I think it's not scary if all versions of minecraft will run on the latest version of java. I also came up with a very dirty method that creates the illusion of a single window, I remove the window frame through WinAPI and move it to the area allocated for the game XD
Hi. I couldn't find a better place than here to write this. Is it possible to redirect Minecraft render output to another window like JavaFx?
I want to write a single-window launcher where the launcher and the game will be in the same window. Your project is the closest thing I've found to my idea. I will be glad if you give me some advice