Posted March 6, 20187 yr Hello everyone, I am in the process of building a mod that will hook into Minecraft and display a widget for the touch bar in Minecraft Forge, but the API requires a LWJGL window handle in long format to properly display, since the touch bar is based on the window currently in focus. I have it working with an auxiliary JFrame, but it disappears when Minecraft gains focus. Does anyone know of a way to retrieve the window long Minecraft uses? Thank you.
March 8, 20187 yr Author On 3/6/2018 at 4:30 PM, diesieben07 said: Minecraft uses Display.create to create the display, which does not seem to expose a handle to the window directly. Accessing Display.getImplementation using reflection and casting the result to MacOSXDisplay should give you access to some internals though, you'll have to see if you can find what you need. Thank you for your response. I have done almost exactly that, and it appears I have access to a bunch of booleans and a ByteBuffer with variable name "window" of length 88. How would this be cast into an NSWindow ID? Also, in 1.13 with LWJGL 3 and GLFW, will this problem be made obsolete?
March 10, 20187 yr Author On 3/8/2018 at 3:56 AM, diesieben07 said: I have no idea what an NSWindow ID is. I do not know. Oh sorry, NSWindow is a macOS specific format of window identification. It is an object, and it is a pain to work with. https://developer.apple.com/documentation/appkit/nswindow Thats the identification process and documentation file. On 3/8/2018 at 4:05 PM, loordgek said: https://github.com/Thizzer/JTouchBar loordgek, I am using that library actually, but getting the hook for the window is my main problem. I need a long that corresponds to the window Minecraft produces when launched so I can hook into and bind the Touch Bar to that specific window. Beyond that, I have made some progress in extraction by reflection, but I seem to have hit a wall with ByteBuffers.
March 10, 20187 yr Author I DID IT!!!!! The window ByteBuffer had to be converted into a Long Array very carefully, and then with trial and error I was able to extract the window's UUID! It's at position 5!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.