Keybind Fix is a client-side Minecraft mod for NeoForge that prevents custom modded keybindings and other unrecognised configuration settings from being wiped from options.txt during game startup.
In vanilla Minecraft, an early startup check writes safety and accessibility flags to options.txt via Options.save().
Because NeoForge loads mods asynchronously, modded keybindings have not yet been registered in the client when this early save occurs. Since Minecraft does not recognise these entries, it removes them from options.txt. By the time mods finish loading, their custom bindings have already been deleted from disk, reverting them to defaults.
- Preservation: The mod intercepts
Options.load()to parse and store all raw lines fromoptions.txt, keeping unrecognised settings safe in memory. - Restoration: It hooks
Options.save(). Right after Minecraft writes the recognised options, the mod compares them against the stored lines and appends any missing modded configuration lines back tooptions.txt. - Reloading: Once mod loading has completed and all mod keybindings are registered, the mod triggers a reload of the options file, applying your custom keys automatically.
- Minecraft:
1.21.1 - NeoForge:
21.1.230or newer - Side: Client-only (safe to include in server folders, where it will be ignored).
To compile the mod, you need Java 21 installed. Run the following command in the root folder:
.\gradlew.bat buildThe compiled mod JAR will be generated at build/libs/keybind_fix-1.0.0.jar.
This project is licensed under the MIT License.