Anything you can do using the SpigotMC API in Java, you can do using ScriptCraft in JavaScript.
ScriptCraft is a plugin for Minecraft Servers which lets operators, administrators and plug-in authors customize the game using JavaScript. ScriptCraft makes it easier to create your own mods. Mods can be written in JavaScript and can use the full SpigotMC API.
ScriptCraft is used in code camps, schools, and with families at home, to learn programming in a fun and familiar environment.
The ScriptCraft plugin also lets you enter JavaScript commands at the in-game prompt. To bring up the in-game prompt press the / key then type js followed by any JavaScript statement. For example: /js 1 + 1 will print 2 ... but it's a lot more fun to generate a building from the command-line, or to blow up a mountain of TNT ...
ScriptCraft also includes many objects and functions to make building and modding easier using JavaScript. For example, the JavaScript Drone object bundled with ScriptCraft provides an easy way to build boxes, spheres, cylinders, houses, castles, and more in Minecraft. The plugin itself contains other plugins which serve as examples for minigames, custom commands, and much more.
More introductory info is found below.
Branch "Bad-Zombie" is the working name of the first of several v3.2+ catch-up builds intended to move forward from production version 3.2.0 from 2016. Watch the branch updates here for details of changes. While the branch remains "Bad Zombie", the point-releases are moving through 3.2.2 and 3.2.3. When this release goes production after beta and adequate feedback, this will become the new v3.3.0.
This v3.2.3.1 is a BETA release 3.2.3.x is now a "frozen" beta. Issues will only be fixed here. No new additions will be made in 3.2.3.x to 3.3.0. Please post all issues with the production ScriptCraft release to the official repo. However for this BETA, please post all feedback to the Issue tracker here or to the Google Group.
See the new Dependencies documentation which has a general-purpose explanation of how plugins work with Minecraft and where ScriptCraft and Spigot fit in the structure.
CanaryMod docs have been removed from this release. CanaryMod is no longer available. There are still many references to CanaryMod but Bukkit/CraftBukkit/Spigot is the only server currently supported.
- Visit the Gitter Chatroom to discuss this plugin.
- Or visit the ScriptCraft Google Group/Forum.
- Twitter : Use hashtags #Minecraft, #ScriptCraftJS, and #JavaScript, and reference @ScriptCraftJS! Some people use #minecraft and #scriptcraft, so follow that too.
- YouTube vids
- To keep up with changes, see Tony's blog.
- See the new and updated documentation
ScriptCraft, also known as ScriptCraftJS, lets you write Minecraft plugins using JavaScript - a programming language that's relatively easy to learn and use. ScriptCraft is a Minecraft server plugin which means it must be used with a Minecraft server. Once you've downloaded and installed the Minecraft server, then installed the ScriptCraft Plugin, you can write your own Minecraft plugins using JavaScript.
Walter Higgins created ScriptCraft to make it easier for younger programmers to create their own Minecraft Mods/Plugins. Mods are written using the JavaScript programming language. Once the ScriptCraft plugin is installed, you can add your own new plugins by adding JavaScript (.js) files in a directory.
- If you're new to programming and want to start modding Minecraft, then Start Here.
- Perhaps you've already used Scratch, have attended a few CoderDojo sessions, or have already dabbled with JavaScript? CoderDojo Athenry have some excellent tutorials for younger programmers who have used Scratch and are interested in modding Minecraft using JavaScript. In particular, they have an excellent Scratch - to - JavaScript tutorial which explains Scratch programs and how to do the same thing in JavaScript. (Some of the details there are a bit old, see the docs in this project for more current details. But for a general introduction, the linked blogs are great!)
- Watch some demos of what you can do with ScriptCraft.
This is a simple mod in a file called greet.js which can be added to the scriptcraft/plugins directory:
function greet( player ) {
echo( player, 'Hello ' + player.name );
}
exports.greet = greet;At the in-game prompt, type:
/js greet(self)(If that doesn't work, try /reload and then the /js command again. This tells the ScriptCraft plugin to read new .js files.)
ScriptCraft is a Minecraft server plugin which only works with Minecraft for personal computers and hosted servers running Windows, Mac, or Linux. It does not work with X-BOX, Playstation, mobile, Windows10, or WiiU versions of the game. You will need to have Java version 1.8 or later installed. Check the Java version by typing java -version at a command prompt.
Before installing ScriptCraft you must first install or build SpigotMC which is a special version of the Minecraft server that makes it easy to customize the game.
- See the Documentation page which links to all other docs in this project.
- See the Help page which links to many other sources of information.
- Then see the Installation doc for details on installing Spigot and ScriptCraft.
Listed below is a simple mod that will make blocks 'Howl' when they're broken.
// copy and paste this code to a new file named 'scriptcraft/plugins/howling-blocks.js'
var sounds = require('sounds');
function howl(event){
sounds.entityWolfHowl( event.block );
}
events.blockBreak( howl );A JavaScript plugin for Minecraft is just a JavaScript source file (.js) located in the scriptcraft/plugins directory. All .js files in this directory will be automatically loaded when the server starts.
To get started writing your own plugin, take a look at some of the examples.
Because the SpigotMC API is open, all of the SpigotMC API is accessible via JavaScript once the ScriptCraft plugin is loaded. There are a couple of useful Java objects exposed via JavaScript in the ScriptCraft plugin:
-
__plugin– the ScriptCraft Plugin itself. This is a useful starting point for accessing other SpigotMC objects. The__pluginobject is of type org.bukkit.plugin.Plugin and all of its properties and methods are accessible. For example:js __plugin.name(no slash at the server command prompt) returns the plugin's name. (JavaScript is more concise than the equivalent Java code:__plugin.getName()). -
server– The top-level org.bukkit.Server object. See the SpigotMC API docs for reference. -
self– The player/command-block or server console operator who invoked the/jscommand. Again, this is a good jumping off point for diving into the SpigotMC API.
If you would like to contribute source code and/or documentation changes, or you would simply like to build and experiment with the code please read the Contributing doc.
Travis build status has been temporarily disabled for this repo.
- To get started using ScriptCraft to Learn JavaScript, read: The Young Person's Guide to Programming in Minecraft
- See the Documentation page which links to all other docs in this project.
- See the Help page which links to many other sources of information.
- Visit ScriptCraftJS.org which will be evolving soon!
- Take a look at some examples.
- Buy the Official ScriptCraft Book A Beginner's Guide to Writing Minecraft Plugins in JavaScript (<< they might be out, try here).
You can find more information about ScriptCraft on Walter's blog and on Tony's blog.
Developer Chris Cacciatore has created some interesting tools using ScriptCraft:
At homedevice.pro ScriptCraft is used with Minecraft Education Edition to help teach mathematics, chemistry, and physics.
To launch a container with SpigotMC and ScriptCraft you can just do
docker run -p 25565:25565 -it tclavier/scriptcraft
You can find all files used to build this container in github project: docker-scriptcraft )( At this time that container includes an older version of Spigot 1.11 and ScriptCraft 3.2.1. The current platform is v1.12.1 with v3.2.3.X ("Bad Zombie BETA ").