This is a proof-of-concept of a use of the MacBook Pro's TouchBar.
It relies on the Forge Modding API, and on JTouchBar (https://github.com/Thizzer/jtouchbar).
By default, it shows the health, the coordinates and the amount of arrows in the player inventory.
As it relies on JTouchBar, you can modify the TouchBar as you want during the game.
Currently, the mod only supports 1.12.2.
Other versions will come soon, when I'll have more time.
To use this mod, you'll need Forge (https://files.minecraftforge.net).
You can download the mod in the Release section (Here).
Then, copy the .jar file into you mods folder. To do so:
If you are on a Mac:
- Open the Finder
- Go to the "Go" menu, then "Go to folder" (or press ⇧⌘G)
- Type
~/Library/Application Support/minecraft/mods
- Copy the .jar here
If you are on Windows:
- Buy a Mac
If you want to adapt the mod to fit all your needs, you can do so. Basically, you just need to know how Forge modding works, and to use the JTouchBar library. Some useful functions are already implemented.
getNSWindowUUID()
: Retrieves the NSWindow UUID. Used to setup the JTouchBar.setupTouchBar()
: Sets up the TouchBar. Called as mod initialises.populateTouchBar()
: This function adds content to the TouchBar. Modify this one if you want more or other items.getTouchBarImageForPath()
: This function returns an Image object usable in JTouchBar control. It takes a string as a parameter, corresponding to the relative path (from the .jar root) to the image.
Note:
You can only add items to the TouchBar in the main thread. So, you can't add controls on Forge events. Then, I advice creating all controls in thepopulateTouchBar
function, having your controls being public and so modify them later.
Note again:
Modifying TouchBar items makes the game very laggy for a short time (mostly on servers, idk why). Please ensure you REALLY need to modify it's content before doing it.