ModderDojo – Updated Scriptcraft Server

5 Feb 2016: I have compiled the latest version of Spigot (Version 1.8.8, 22 Jan 2016), which is a high-performancse server based on CraftBukkit, and added in the latest version of Scriptcraft (Version 3.1.12, 30 Dec 2015).

You can download it here:

The version of CanaryMod+Scriptcraft that we were running for the past couple of months was very unreliable, so hopefully this will be better!

ModderDojo Topic 7: Planning and Building a Complex Structure Mod in Minecraft


This topic continues from ModderDojo Topic 6: JavaScript Operators and ScriptCraftJS Drone Functions.

Sharing a Server:

In previous weeks before we stopped for Christmas, some people struggled to make progress through no fault of their own: they were hampered by CanaryMod crashing a lot on some people’s computers.

To work around this, everyone can connect to my computer as the Minecraft server, and I will also create a shared folder on the computer so you can drop your mods into it.

Please review these notes from several weeks ago: Topic 2: Connecting to Each Other’s Servers.

This Week’s Challenge:

This week (and for the next week or two), your challenge is build a substantial mod in ScriptCraft that, when you run it, will create an impressive-looking structure!

A key step to success here is planning and design: as I have said before, a  programmer’s most important tools are paper and pencils, for figuring out what you want to create before you write code for it.

You should review the following:




ModderDojo Athenry Topic 6: JavaScript Operators and ScriptCraftJS Drone Functions


Operators in any programming language are used when you want to calculate something new: they operate on values. variables, or expressions to produce a new value.

Since ScriptCraft is built on the JavaScript langauge, it uses standard JavaScript operators. As it happens, many other programming languages (including C, C++ and Java) use the same operators or very similar ones.

JavaScript Operators

Drone Functions:

As we have seen before, in ScriptCraft you use a drone to do your building for you. The drone has functions that are part of it.

Here are some of the main drone functions that are useful when building your mods:

ScriptCraft Drone Functions

You can find lots more about these and other functions in the ScriptCraft API Reference:

Example: Build a Pyramid

This example is based on a very nice program writing by Ruaidhri from Coderdojo Athenry last year, updated slightly because some ScriptCraft commands have changed in the meantime.

// Copyright Ruaidhri from ModderDojo Athenry,
// slightly updated by Michael and Alex.
// Builds a pyramid with entrance and lights inside.

exports.pyramid = function()
echo('making a pyramid');
var d = new Drone(self); // 'self' means start drone beside me


var size=31;

// Make the walls
while (size > 0)

// Entrance

// Lights inside
var t = 0;
while (t<4)
t = t + 1;

ModderDojo Topic 5: Time to Get Constructive!


This week builds on ModderDojo Topic 4, when we learned a bit about the basics of ScriptCraft and saw how it handles loops, decisions and variables compared to Scratch:

This week, our goal is to build a first structure mod in ScriptCraft. Ideally you should work in pairs. This to achieve this goal will involve:

During the session, I will ask people to load their mods onto my computer, demo them to the group, and explain how their code works. To get things started, at we can take a look at some mods from last year and how they work:

Practical notes:

  • Read the ScriptCraftJS API reference to see what commands you can use for your structures:
  • During development and testing, you can end up with lots of incomplete structures that slow down your CanaryMod server. A simple fix is to delete your world:
    • Stop your CanaryMod server
    • Open the CanaryMod folder on your computer: in it you will see a folder called worlds, and inside it one called default, and inside that default_NORMAL.  Delete default_NORMAL and all of its contents.
    • While you are at it, edit your world’s properties for when it is re-created: you can do this by opening canarymod – config – worlds – default – default_NORMAL.cfg. To make your new world superflat, write world-type=FLAT and you could also change other properties such as spawn-monsters=false
    • Restart CanaryMod to create a new, empty world
    • Re-run your scripts to recreate structures that you want

ModderDojo Topic 4: Moving from Scratch to JavaScript


Note: some individual topics are short: we got most of the way through the first 3 in our taster session. See this post:

JavaScript is a well-established programming language, mainly used in web development. ScriptCraft is a Minecraft mod that allows you to write JavaScript code for building structures in Minecraft and writing new Minecraft mods. (So it’s a mod for creating other mods.)

Steps 1-3: Install ScriptCraft, Learn how to Connect to a Server, and Create a First Mod

We covered these steps in the first two weeks:

  1. Getting Started with ScriptCraft and JavaScript
  2. How to Connect to Each Other’s Servers
  3. Creating our First ScriptCraft Mods

To try out ScriptCraft, look back at the introductory posts here:

Step 4: Comparing JavaScript to Scratch

Some people criticise Scratch as being “childish”, but I don’t agree. While it is designed so that even 8 year olds can use it, it is still has all of the key features of ‘adult’ programming languages, as listed in the image at the top of this post.

(Technically, any programming language with variables, decision and loops is Turing Complete.)

This means that, if you already know how to write a Scratch programs that use these features, you will be able to apply that knowledge to any other language, such as JavaScript. The syntax of JavaScript is different, but it uses the same computational thinking.





  • Even though they have basic ideas in common, every programming language has its own specific commands that relate to its purpose: Scratch is focused on 2D games and animations, while ScriptCraft is focused on operating inside Minecraft, and JavaScript generally is used for interactive websites.
  • the echo command that features in these slides is not a standard JavaScript command, it is just used in ScriptCraft to display things on your screen in Minecraft.  Everything else is standard JavaScript.

Minecraft Modding Taster Session – Week 1


This season at CoderDojo Athenry, the advanced groups are all starting with taster sessions of the various topics we will cover.

In Week 1, the topic we are covering is Minecraft Modding using JavaScript.

Here are the notes:

  1. Getting Started with ScriptCraft and JavaScript
  2. How to Connect to Each Other’s Servers
  3. Creating our First ScriptCraft Mods

Coming up next week: in introduction to Raspberry Pi and Electronics

CoderDojo Athenry at Coolest Projects 2015

Congratulations to everybody from CoderDojo Athenry who participated in the CoderDojo Coolest Projects event on 13 June 2015. It was a very impressive event, held in the RDS Dublin, with over 500 projects from CoderDojo ninjas from Ireland and worldwide.

Here are photos of the participants from CoderDojo Athenry.

Games Category:

James from the Minecraft Modders group with his technically impressive XyZ Mod with World Gen and Gauntlets:


Eoin from the Minecraft Modders group who entered the detailed and very well structured Global Cuisine mod:


Ruaidhrí and Luke from the Minecraft Modders group who entered the Weapons, Armour and Money mod:


Hardware Category:

Michael and Mikey from the CoderDojo Athenry PiDojo who entered their clever and topical Shower Evaluator project that times your shower and displays the amount of water used, cost of water, and cost of energy:


Alaidh from the PiDojo group who entered the very innovative Sensor Guide for the visually impaired, which was impressively backed up with scientific evaluation:


Scratch Over 10s:

Emily and Chloe from the Scratch Advanced group had a Scratch program with great environmental potential, Cúisneor, that helps to reduce food waste:


Scratch Under 10s:

Rachel from the Scratch Beginners/Intermediate Group was our youngest entrant from CoderDojo Athenry, aged 8, and had a fantastic Scratch app for helping young children to learn the letters of the alphabet:


Well done to everybody who entered!

We should also mention that three projects won prizes:

  • Ruaidhrí and Luke won a prize for best use of Microsoft technologies (Microsoft owns Minecraft, of course)
  • Alaidh won a prize for being a finalist in the Hardware category
  • Mikey and Michael also won a prize for being a finalist in the Hardware category.

ModderDojo Countries Mod: How to Upload Files to GitHub

Thanks to Ninja James for these excellent and detailed instructions, and for setting up a GitHub repository for us to share our code when working on the Countries Mod.

How to stage files to a repository.

WARNING: Please upload your mod in a folder with your topic.

Step 1. Create a folder with the name of the topic your doing for the country mod.

Step 2. Install git =, keep pressing next as we will not need any changes to the installation.

Step 3. For example I have my folder on my desktop, so I right click my desktop and click “GIT GUI”. A box should pop up.

Step 4. Click “Clone existing repository”, The source location is the git repo its self, so in the box put this :

Now the Target directory is your folder, click browse and find your folder, for example mine would be on the desktop, its called biomes, select your folder.

Example : My target dir is C:/Users/coderdojo/Desktop/Test Git/Biomes.

Click Clone, This may take a couple of minutes depending on your internet speed.git

Step 5. A window should pop up, looks like this ——->


For this example im going to put 2 files in my CLONED FOLDER!. WARNING: Put your your forge files in a folder with your name. Then once your have done that click [RESCAN], your forge files should pop up. Then click [STAGE CHANGED] and click [YES], all your files should move into the [GREEN AREA]. In the box that says [COMMIT MESSAGE], put a message that is related to your Topic in the mod.

Step 6. Click [COMMIT] after you have written your message.

Your files in the [GREEN AREA] should not be there.

Step 7. Now click [PUSH], a box should pop up click push again!

It should ask for my details… Username = FrictionlessPortals

My Password, you will have to ask me through skype, Due to security reasons.

If it says [SUCESS] you’ve sucessfully put your files on github!

If you want more help add me on skype as hypixel.jamertheredstonegamer.

ScriptCraft – An Exploding Chickens Mod

A few weeks ago we were lucky enough to have a visit from YouTuber and professional Minecraft modder (for the HyPixel server) codename_B (a.k.a. VladToBeHere, a.k.a. Ben).

Ben (left) addresses CoderDojo Athenry. ,Also pictured: Auburn, Ben's girlfriend, and our own Michael Madden

Ben (left) addresses CoderDojo Athenry. Also pictured: Auburn, Ben’s girlfriend, and our own Michael Madden

Ben is an extraordinary programmer who just breathes code. On his YouTube channel he regularly creates a complete MineCraft plugin in only sixty seconds!

After addressing the entire Dojo, Ben showed our modder group and a few other more advanced coders how to make a quick plugin which causes chickens to explode when a player kills them.

Ben’s mod was written in Java and used the Bukkit API to interface with MineCraft.

Porting the Plugin to ScriptCraft

ScriptCraft is built on top of Bukkit. Because of this, almost all the Bukkit API is available for use in ScriptCraft. I believe there are a few Java-only bits in Bukkit, but I haven’t encountered them.

I realized that, in theory at least, it should be possible to port Ben’s plugin to ScriptCraft. In practice, it proved to be more straightforward than I could have hoped. If you don’t already know Java, ScriptCraft is a great place to start if you want to create MineCraft mods.

ScriptCraft and Bukkit References

When writing something new, you’ll need to be able to look-up things that you are not familiar with. Two references I used for this script, apart from Ben’s original code, were:

  1. ScriptCraft API
  2. Bukkit API (from Spigot)

Browsing these resources is also a good way to see what can be done and to thereby generate new ideas.

Anatomy of the Plugin

The plugin is composed of four parts:

  1. Two variables to represent the Bukkit types which represent chickens and players respectively
  2. A loading function which we will run when the plugin loads
  3. An event handling function which will be called whenever one entity damages another
  4. A call to the loading function, at the bottom of the file, to make it run as soon as ScriptCraft reads it

Let’s talk about each of these parts in turn.

Variables to Represent Bukkit Types

After a require(‘events’) line (to make sure we can reference the events object), there are two lines as follows:

var bkPlayer = org.bukkit.entity.Player;
var bkChicken = org.bukkit.entity.Chicken;

These are ‘types’ which represent an entity of type Player and an entity of type Chicken respectively. We’ll use them in a bit to determine, when we’re told one entity has damaged another, that it was a Player entity causing damage to a Chicken entity.

The Loading Function

The next part of the script is the loading function. It’s short and really only does two things:

  1. Announces that the plugin has loaded by printing a message to the console
  2. Tells Bukkit that we’d like a function of our own to be run each time that a particular event occurs. In this case it’s the event that fires every time one entity damages another.

Here’s the code:

// The function which will run when we load this module
var _loadMod = function()
  // Announce ourselves to the console
  console.log("Exploding Chickens: [Loading ScriptCraft Mod]");

  // Tie our code into the event that fires every time one entity damages another

We’re passing events.entityDamageByEntity() the name of our function we’d like to have run. That function (_entityDamageByEntity) and this function (_loadMod) both have underscores at the start of their names. It’s a JavaScript convention which indicates that we’re never be calling these functions by name from outside this file. They’re private or internal functions.

The Event Handling Function

This is the most complex part of the module, but not terribly so. Here’s the code:

// The code that we want to run each time one entity damages another
var _entityDamageByEntity = function(event)
  // Find out, from the event, who's getting damaged and who did the damage
  var damagedEntity = event.getEntity();
  var damagingEntity = event.getDamager();
  // If it's a chicken getting damaged by a player, game on...
  if (damagedEntity instanceof bkChicken && damagingEntity instanceof bkPlayer)
    // Announce in the console that we've detected a player damaging a chicken
    console.log("Exploding Chickens: [A player damaged a chicken]");
    // Schedule a task to run in five seconds.
    server.scheduler.scheduleSyncDelayedTask(__plugin, function() 
      // Check to see if the damage brings the chicken's health
      // down to, or below, zero. If so, it's dead...
      if (damagedEntity.getHealth() - event.getDamage() <= 0)
        // Get the chicken's location
        var loc = damagedEntity.location;

        // Create an explosion at the chicken's location. 
        // A big one..., 10.0);
    }, 20 * 5);

What does it do?

  1. Gets the entity that caused the damage and the entity that was damaged and check to see if they’re a player and a chicken respectively
  2. If they are a player and a chicken, Schedule a task to run in aprox. five seconds. This task can result in an explosion, so it’s nice to have a little “getting away” time.
  3. When our task runs, see if the amount of damage inflicted was enough to bring the chicken’s health down to zero (or below) and if it was, make a massive explosion where the chicken was.

The Bukkit function scheduler.scheduleSyncDelayedTask() needs a reference to the plugin which is asking for the task to be scheduled. In this case it’s ScriptCraft and there is a special automatic variable, __plugin, which ScriptCraft can use to refer to itself when it needs to.

And that’s pretty much it!

Getting it All Going

The last line in the file is just a call to our _loadMod() function. This will get run immediately by ScriptCraft when it read it, setting the mod into action:

// Run this script as soon as the file's loaded


Here’s the mod in action:

Sorry chickens*.

The script file can be downloaded from here. I hope this inspires you to create your own server mods using ScriptCraft.



* The author is a vegetarian and general soft touch who even tends to feel bad about exploding virtual animals…