External fixes for @Nullable/@Nonnull annotations in the Minecraft source code, for mods that want strict and correct null annotations.
These annotations are applied to decompiled MCP names, so they will need to be updated when the names change. Hopefully this project will remain small, there are not a huge number of wrong annotations in Minecraft.
-
Fork and checkout this project to your computer using git.
(toE:\code\MinecraftAnnotationsin this example) -
Enable External Annotations in IntelliJ
- Go to
File -> Settings(Ctrl+Alt+S). - On the left, navigate to
Editor -> Code Style -> Java. - Select the
Code Generationtab at the top right - Enable the
Use external annotationscheckbox at the very bottom.
(you may have to scroll down to see it)
- Add MinecraftAnnotations to your Project's Minecraft Source
- In IntelliJ go to
File -> Project Structure(Ctrl+Alt+Shift+S) - Select
Moduleson the left - Select your
mainmodule - Select
forgeSrc, which is the decompiled Minecraft source code - Click the pencil icon on the right to edit it.
- Use the plus icon at the left to add the
MinecraftAnnotationsfolder.
It will automatically show up as Annotations, it should look like the image below.
- Highlight a method, field, or parameter you want to annotate.
- Type
Alt+Enterto open theShow Intention Actionsmenu. - Choose the annotation you want
- If it asks you where you want to save external annotations, choose the MinecraftAnnotations directory.
- Make a PR to this project with your fixes so that everyone can benefit!



