Appendix B. Eclipse Shortcuts and Correct Imports
Eclipse Shortcuts
Eclipse is a very powerful tool and includes lots of options for editing Java. These options can be accessed using different menus. However, sometimes clicking menu items for repetitive tasks can be cumbersome or boring, so Eclipse enables some helpful shortcuts that allow you to become a better modder. For example, the Import shortcut can be very useful if you have a lot of classes to import.
Table B-1 provides a handy list of shortcuts (note that there are different shortcuts depending on your platform).
Usage | Windows shortcut | Mac shortcut |
---|---|---|
Save the current file |
Ctrl-S |
Cmd-S |
Import everything |
Ctrl-Shift-O |
Cmd-Shift-O |
Comment the selected text |
Ctrl-/ |
Cmd-/ |
Uncomment the selected text |
Ctrl-/ |
Cmd-/ |
Show options for code completion |
Ctrl-Space |
Control-Space |
Quick fix for errors and warnings, depends on the cursor position |
Ctrl-1 |
Control-1 |
Rename the selected element |
Alt-Shift-R |
Alt-Cmd-R |
Format source code |
Ctrl-Shift-F |
Control-Shift-F |
Maximize Java editor |
Ctrl-M |
Cmd-M |
Run Minecraft |
Ctrl-F11 |
Cmd-Fn-F11 |
Complete list of shortcuts |
Ctrl-Shift-L |
Cmd-Shift-L |
Correct Imports
Different Java packages can have classes with the same name. Obviously, only a class from a particular package will serve the intended purpose for our code. So, when importing classes during mod creation, it’s important to pick the right package.
This can be easily done using Ctrl-Shift-O ...
Get Minecraft Modding with Forge now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.