CoffeeScript integration in ScriptCraft https://github.com/walterhiggins/ScriptCraft
This repository has been archived on 2021-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
2014-11-14 19:57:48 +00:00
build Fix problem with change to bukkit xml doc change 2014-06-14 15:37:34 +01:00
docs updating release notes. 2014-11-09 13:06:23 +00:00
lib Include docs for both bukkit and canary event helpers. 2014-11-09 11:52:10 +00:00
screenshots Example of the use of block type 2013-01-20 21:20:15 +00:00
src ensure Canary.inf has latest version number. 2014-11-14 19:57:48 +00:00
.gitignore Added new sounds module 2014-05-10 18:45:48 +01:00
.travis.yml Update .travis.yml 2014-10-18 18:58:24 +01:00
build.local.properties.sample merge mrdon's changes 2013-06-03 00:02:28 +01:00
build.properties Update build.properties 2014-11-13 14:32:02 +00:00
build.xml ensure Canary.inf has latest version number. 2014-11-14 19:57:48 +00:00
contributing.md updated contributing.md to refer to idiomatic js guide 2014-01-30 00:03:07 +00:00
license.txt Adding MIT License 2014-01-12 16:29:28 +00:00
README.md Added clarification about use of CanaryMod vs Bukkit 2014-11-09 12:01:18 +00:00

Let's begin...

I created ScriptCraft to make it easier for younger programmers to create their own Minecraft Mods. Mods are written using the Javascript programming language. Once the ScriptCraft mod is installed, you can add your own new Mods by adding Javascript (.js) files in a directory.

  • If you're new to programming and want to start modding Minecraft, then Start Here.
  • If you've already used Scratch, have attended a few CoderDojo sessions, or have already dabbled with Javascript, then Start Here.
  • Watch some demos of what you can do with ScriptCraft.

This is a simple mod in a file called greet.js in the scriptcraft/plugins directory...

exports.greet = function( player ) {
   echo( player, 'Hello ' + player.name );
};

At the in-game prompt, type...

/js greet(self)

... to see the greeting. Anything you can do using CanaryMod or CraftBukkit's API in Java, you can do using ScriptCraft in Javascript.

Description

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 Javscript and can use the full CanaryMod API or Bukkit API. I recommend using CanaryMod because CraftBukkit is no longer being actively developed due to a legal dispute. The ScriptCraft mod 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.

ScriptCraft also includes many objects and functions to make building and modding easier using Javascript. The Javascript Drone object bundled with ScriptCraft provides an easy way to build at-scale in Minecraft. See the attached cottage.js file for an example of how you can use the sample Drone plugin to create new buildings in Minecraft.

Prerequisites

You will need to have Java version 6 or later installed on your machine. Check the version by typing java -version at a command prompt. You will need to install CanaryMod or install Bukkit on your machine (I recommend using CanaryMod as Bukkit is no longer being actively developed). CanaryMod and Bukkit are both versions of Minecraft (server) that make it easy to install plugins and customize Minecraft. You can download the CanaryMod server here.

Installation

If you don't want to compile from source, you can download the compiled plugin here and copy it the craftbukkit's plugins directory.

Post Install

Once installed, a new scriptcraft/plugins directory is automatically created. All files in the scriptcraft/plugins directory will be automatically loaded when the server starts. Only players who are ops can use this plugin. You can grant a player op privileges by typing 'op ' at the server console prompt or by adding the player's username to the ops.txt file in your server directory.

Launch the server, then launch the Minecraft client and create a new server connection. The IP address will be localhost . Once you've connected to your server and have entered the game, look at a ground-level block and type ...

/js up().box( blocks.wool.black, 4, 9, 1 )

... This will create a black monolith structure 4 blocks wide by 9 blocks high by 1 block long. Take a look at the src/main/javascript/drone/drone.js file to see what ScriptCraft's drone can do. If you're interested in customizing minecraft beyond just creating new buildings, take a look at [./homes/homes.js][homes] for examples of how to create a javascript plugin for Minecraft.

A Javascript mod for minecraft is just a javascript source file (.js) located in the craftbukkit/plugins/scriptcraft/plugins directory. All .js files in this directory will be automatically loaded when the craftbukkit server starts. To get started writing your own mod, first take a look at some of the existing mods in the homes, arrows and signs directories.

Additional information

Because the CanaryMod API is open, all of the CanaryMod 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 CanaryMod objects. The __plugin object is of type net.canarymod.plugin.Plugin and all of its properties and methods are accessible. For example... js __plugin.name returns the plugin's name (javascript is more concise than the equivalent java code: __plugin.getName() ).

  • server - The top-level net.canarymod.Server object. See the CanaryMod API docs for reference.

  • self - The player/command-block or server console operator who invoked the /js command. Again, this is a good jumping off point for diving into the CanaryMod API.

Contributing

If you would like to contribute source code and/or documentation changes please read contributing.md

Status

Travis Build Status

Bukkit Configuration (You can ignore this if usng CanaryMod)

ScriptCraft also works with Bukkit Plugin and uses the Bukkit Configuration API. On first loading, ScriptCraft will create a config.yml file in the plugins/scriptcraft/ directory. This file looks like this...

extract-js:
  plugins: true
  modules: true
  lib: true

This file allows scriptcraft admins to turn on or off re-unzipping of the modules, plugins and lib folders when deploying a new version of scriptcraft. It's strongly recommended that the lib directory always be set to true to get the latest core scriptcraft code . The modules and plugins directories are optional and not part of scriptcraft core.

Further Reading

ScriptCraft has its own website with further information.

You can find more information about ScriptCraft on my blog.