Jump to content

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


Recommended Posts

Posted

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.

Posted
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

Posted
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.

Posted

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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