MinecraftForge / Documentation

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

Intermission: Key Mappings #462

Closed ChampionAsh5357 closed 2 years ago

ChampionAsh5357 commented 2 years ago

We interrupt the work on menu documentation to bring you an important announcement: key mappings are now documented on the official docs!

This documents Key Mappings in it's entirety including use cases within a common environment.

Closes #461

JontomXire commented 2 years ago

Amazingly quick, and very well written, thankyou.

Only one question: What packages need to be imported for all this to work? I am guessing just the package that contains KeyMapping. Maybe also the one that contains RegisterKeyBindingsEvent?

ChampionAsh5357 commented 2 years ago

What packages need to be imported for all this to work? I am guessing just the package that contains KeyMapping. Maybe also the one that contains RegisterKeyBindingsEvent?

It'll depend what you're attempting to do. You can import classes as you see fit (most likely using the autofill function of your IDE when calling a specific class). If you have any more questions, ask on the forums or discord after making a solid attempt at implementation yourself.

JontomXire commented 2 years ago

I was suggesting it as an improvement to the documentation. The MSDN documentation, and the man pages always list the include file for a given class or function. In fact I don't remember seeing any C or C++ documentation that doesn't. Also, the Java documentation (for example, picking at random, https://docs.oracle.com/javase/7/docs/api/javax/swing/border/AbstractBorder.html) lists the java object which implicitly contains the package that needs to be imported.

This documentation is primarily about the KeyMapping class with mentions of other objects and functions. I was suggesting that it may be useful for other people if the import packages or full Java object path were specified, at least for the Forge stuff that isn't part of standard Java.

ChampionAsh5357 commented 2 years ago

I'm well aware of how the C/C++ documentation typically handles those cases. Additionally, I'm also aware at how Java handles the generated javadocs.

That said, this does not really fall into the traditional definition of docs. It is more of a quick reference to understanding the concepts of vanilla and it's Forge additions. Key mappings are a purely vanilla system with some Forge hooks for additional features.

In addition, while having imports are useful, they are nothing more than syntactic sugar in Java. When using a proper IDE, you can almost always search the necessary class to add without the full string. This is especially the case since most classes in vanilla are almost uniquely named.

Modders without the necessary knowhow of the language or how to do their own research will be stymied. Modders are required to have the relevant background and critical thinking skills to receive support from us, so this would be considered a necessary test of skill.

If you would like a more proper documentation on vanilla stuff, I would checkout Parchment, which adds in parameter names and javadocs. Forge documentation is typically provided as a deprecated tag to the relevant code, or documented on the class itself.

ChampionAsh5357 commented 2 years ago

I should probably clarify: I'm not trying to discredit your idea, it's purely a good way to force people to read the code and understand it's complexities themselves after getting the gist from a quick guide.

However, I will take a look into finding a tooltip system such that on hover the full path is revealed.

JontomXire commented 2 years ago

I appreciate your feedback.

I don't actually use an IDE myself. As you say "it's purely a good way to force people to read the code and understand it's complexities themselves", so in the same way I prefer to read the documentation and fully understand what the parameters do, rather than have an IDE prompt me as to how to fill in the parameters to a function.

I also apologise for my lack of understanding. I am not new to Java but am new to modding and am having a lot of difficulty finding any proper documentation at all.

Thanks for your help. I will move to the forums now.