Jump to content

[1.12.2] Hooking into LWJGL Minecraft window to add macOS Touch Bar features


mrburgerUS

Recommended Posts

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.

Link to comment
Share on other sites

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?

Screen Shot 2018-03-07 at 7.28.34 PM.png

Link to comment
Share on other sites

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:

 

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.