MinecraftForge / Documentation

Read the docs MinecraftForge documentation
MIT License
465 stars 192 forks source link

Requesting documentation on KeyMapping. #461

Closed JontomXire closed 2 years ago

JontomXire commented 2 years ago

The basics of key binding are probably a fundamental of writing any mod. Certainly every mod I have ever played (and there have been a lot) has custom keys.

I have just spent 2 and a half hours searching the internet and the forge forums for information on how to do this. Almost everything I have found refers to using a KeyBinding instance. KeyBinding has apparently been replaced by KeyMapping.

Every article and guide is incomplete, except for the very very old ones for very very old versions of forge (1.7.2).

I have just about figured out how to instantiate a KeyMapping object, although I have no idea how to associate it with user friendly text in the settings UI. The article that helped with that also mentioned that you need to register with a different event source for the key input event than you do for registering the keybinding.

I am really really surprised that the documentation has absolutely nothing on key input. I cannot imagine how anyone ever figured it out. Maybe Java works VERY differently from C++ (which I am more used to), but is there no documentation on any of the classes and interfaces? In C and C++ we use Doxygen on the header files to autogenerate documentation that often then gets published on the internet. Failing that we can go read the header files and infer how to use the functions (and see what functions are there). However Java packages are all precompiled object files and I have no idea how to get at the information on what functions are available and what parameters they take.

Many years ago I did a load of Java programming and I am pretty sure that all the classes and packages I used were properly documented.

Please add a basic keybinding to the example mod and/or to the documentation.