Skip to content

TeamMangoMilk/Keybind-Fix

Repository files navigation

Keybind Fix

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.

The Bug

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.

How it Works

  1. Preservation: The mod intercepts Options.load() to parse and store all raw lines from options.txt, keeping unrecognised settings safe in memory.
  2. 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 to options.txt.
  3. 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.

Requirements

  • Minecraft: 1.21.1
  • NeoForge: 21.1.230 or newer
  • Side: Client-only (safe to include in server folders, where it will be ignored).

Build from Source

To compile the mod, you need Java 21 installed. Run the following command in the root folder:

.\gradlew.bat build

The compiled mod JAR will be generated at build/libs/keybind_fix-1.0.0.jar.

License

This project is licensed under the MIT License.

About

Reliable keybinding fixes for modded Minecraft

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages