O'Reilly logo

A Beginner’s Guide to Writing Minecraft Plugins in JavaScript by Walter Higgins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Exploring JavaScript in Minecraft

Once you’ve installed scriptcraft, you can use the js command to evaluate JavaScript code. The js command will try to evaluate any of the text that follows it as JavaScript. You must enter a space between the js and the JavaScript you want to evaluate. The js command will evaluate the JavaScript and print out the result of the expression. So if you type js 2 + 7, the js command will take 2 + 7, will try to evaluate it, and, if it can, will print the result. Let’s practice with a few simple JavaScript expressions.

Basic Math Operations

The expressions you’ve used so far are simple addition operations. JavaScript has a number of mathematical operations. I want you to type each of the following expressions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required