Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Gadgets and Digital Lifestyle

  • Print
  • + Share This
Like this article? We recommend

Your First Minecraft Mod

Let's write a simple plugin that displays a message in the Server console when the server starts up. In the same directory where the CanaryMod .jar file lives, there should now be a scriptcraft directory, and in that directory is a plugins directory. ScriptCraft is a CanaryMod plugin that lets you load JavaScript plugins.

Using a text editor, create a new file called first.js in the scriptcraft/plugins/ directory, and type the following code in first.js:

console.log( 'Hello World' );

Save the first.js file; then stop CanaryMod and start it again. This time you'll see the message Hello World appear in the CanaryMod console. What happened here is that your first.js file was loaded during the Server startup, and the JavaScript code inside it was executed. The statement console.log( 'Hello World' ) logs (prints) a message—in this case, the message 'Hello World'—to the console. This isn't a terribly exciting Minecraft mod, but it illustrates how Minecraft mods are loaded—at startup time.

  • + Share This
  • 🔖 Save To Your Account