Extend Minecraft Pi Edition using JavaScript via Java

Jun 11, 2014 0 Replies

It is possible to build things, sense things, move around and handle events in

formatting link
Minecraft Pi Edition using
formatting link
JavaScript via
formatting link
Java. JavaScript is normally used in web browsers but can also be used by web servers, but also for stand-alone programs. JavaScript is a rather flexible language and looks similar to
formatting link
C but is inspired by
formatting link
LISP. It is e.g. possible to write a program that puts together a program using strings of text and then runs it. JavaScript is getting faster all the time with e.g.
formatting link
asm.js and
formatting link
SIMD. There are many implementations of JavaScript and this example uses Rhino which has a good connection to Java, which means we can use the Minecraft Pi Edition
formatting link
API for Java.



Start a terminal on Desktop 1 in

formatting link
Raspbian on
formatting link
Raspberry Pi. And enter the text after the prompt "$ " or "js> ". There are no line-feeds or carriage-returns in the command-lines even if they are shown broken.



$ sudo apt-get install rhino rlwrap



$ rlwrap java -cp ~/mcpi/api/java/\*:/usr/share/java/js.jar org.mozilla.javascript.tools.shell.Main



Try this: js> for(y=1;y


Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required