How to Write Minecraft Mods with Functions - For Dummies

Here, you learn how to write a Minecraft mod that has a function named main. From now on, it will be called the main function. When you run a mod, your mod always starts running from the main function.

Notice that the Saying Hello badge is similar to the Write Your First Mod badge, except that it has three messages instead of two. Here’s the code you should write to complete the Saying Hello badge.

image0.jpg

To get help with completing badges, click the Click for Hints link on the progress bar at the top of the mod, or watch the video to see how to solve the challenge. Sometimes it’s tricky to position the blocks in the right spot, so you can always reorder them after you have applied them to your programming environment, though.

To earn the badge, you have to test your mod in the Minecraft simulator on the LearnToMod site. The progress bar in this mod says that you have completed writing 100 percent of the code, but it reminds you to test the code in the simulator.

image1.jpg

To test your mod in the simulator, click the Simulator button, which is next to the Mod button.

image2.jpg

The Minecraft simulator sometimes doesn’t work in older versions of browsers. If you download the Unity Player plugin and the simulator still doesn’t work, update your browser or use a different one. You can download free and reliable browsers such as Chrome, Safari, or Firefox.

Unity Player is the third-party software that supports your being able to see Minecraft in the browser.

When you click the Simulator button, the simulator pops up. To test your mod in the simulator, simply press the M key on the keyboard.

image3.jpg

After the mod runs, you earn the badge. You see a screen shot of you completing the badge.

image4.jpg

To enter the simulator, drag the mouse into it and click anywhere. To exit the simulator, press the Esc key on the keyboard.