Writing Java Programs for Minecraft Mods
A computer program is a set of instructions that tells a computer what to do. These instructions are given to a computer using a programming language.
During this chapter, you create a simple program with the Java language by entering it into a text editor. When that’s done, you save the program, compile it, and test it. Then you break it on purpose and fix it again, just to show off.
What You Need to Write Programs
To create Minecraft mods or any other Java programs, you must have a programming tool that supports the Java Development Kit (JDK) such as the NetBeans integrated development environment (IDE). You need a tool that can compile and run Java programs and a text editor to write those programs.
With most programming languages, computer programs are written by entering text into a text editor (also called a source code editor). Some programming languages come with their own editor. NetBeans includes its own editor for writing Java programs.
Java programs are simple text files without any special formatting, such as centered text or boldface text. The NetBeans source code editor functions like a simple text editor with some extremely useful enhancements for programmers. Text turns different colors as you type to identify different elements of the language. NetBeans also indents lines properly and provides helpful programming documentation inside the editor.
Because Java programs are text files, you can open and edit them with any text editor. You could write a Java program with NetBeans, open it in Notepad or Text Edit and make changes, and then open it again later in NetBeans without any problems.