Playing with Scratch commands to build various things in Minecraft, I “lost” the drone many times when going from one function to another, making it difficult to know the exact position of where the new building will start. I also wanted to be able to follow the progress of each building in Minecraft client without being forced to move the mouse to the expected position of the drone.

To follow the drone I created the turn function (based on teleport) that makes the player look to the desired direction – either to a specific point or to the drone. I also wanted to make the drone visible. First try was done in Scratch.

The Show drone function makes the block at drone’s position flash 3 times by replacing it with a skeleton skull that has the same orientation as the drone.

The visual effect is quite nice, but it can make undesired changes. In the video you can see how temporarily replacing a dirt block removes the grass on it. The result will be worse when changing a chest: its contents would be lost. The effect is also visible only when the block at the drone position is visible itself to the player.

So I decided to create an entity at drone’s position that can be seen thru opaque blocks. The easiest way was to apply glowing potion effect to this “ghost” (which in fact is an armor stand). The potion effect has the advantage to disappear after the specified amount of time, so there is no need to remove it explicitly in code after a while.

To show how it works I created a Scratch project with a basic pixel editor for 8×8 or 16×16 images that can be then created in Minecraft using one of the colored materials (wool, glass or hardened clay).

The drone movement is easy to follow and usually is synced with building operations for small cuboids, although in this video the server lags at the beginning (because I have on the same machine the MC server + client, Scratch and QTime for video capture). When using instructions to build bigger cuboids or more complex structure it would be a good idea to insert delays between them (using Scratch wait block).

The next step would be to make the ghost change the orientation when using drone turn command, but I wasn’t yet able to set the rotation of the armor stand, so I’m still searching for a solution.

As described in my previous posts, I found Scriptcraft, the Minecraft plugin created by Walter Higgins, to be a very powerful tool for Minecraft modding and also for learning Javascript. I use it myself to learn and also for teaching kids to code as they can see immediately the result of the issued commands. One of the features I love is that it implements a drone, described as “an (invisible) object you create every time you execute any of the building or movement functions”, that is very similar to the turtle from other languages.

While kids aged 10 or more can understand how it works and can learn how to create their own functions, younger ones can be overwhelmed by the syntax rules and the need to create the files or to link additional modules.

Making it all work together

Following the installation instructions for MC server you should have created a script or a batch file (depending on the OS) containing a line similar to this (I didn’t use the other parameters):

java -Xms512M -Xmx1G -jar spigot.jar

Instead of using this script to launch the server, you must create a mc.js file in the same folder, where you copy the following text (taking care to keep your previous parameters for spawning the new java process):

It will launch Minecraft server as a child process and will listen to ports 8088 and 8089. On port 8088 it receives commands and poll requests from Scratch and on port 8089 it receives information from MC server – current block values and result of some operations. You can leave the ports unchanged, or you can choose other values, but you will need to also update the following two files.

In the Scriptcraft plugins folder you have to copy the file scratch.js which interprets commands passed by the Node.js script.

It keeps track of IPs for each client so you can have multiple connections from different computers. You can leave 127.0.0.1 for scratchReturnAddress as the processes run on the same machine, and the port must be the same as the second one from mc.js (8089).

On the client you will have to use MCextension.json file for Scratch. The port must be the same as the first port defined in mc.js (8088), but you need to update the IP address to match the server’s address if you are using a separate computer. You should also update the default player, replacing playerName with the one you will use most frequently.

Pressing Shift and clicking File in Scratch will provide access to Import experimental HTTP extension (the last option in the list) for opening the MCextension.json file.

By doing this, in the More blocks category you will have access to new blocks and variables. Before issuing any other command you should use Connect User and the name of a player with an open MC session on the server as a parameter. When connected, it will put a message in Minecraft chat and will automatically create a drone at player’s position, which will execute all the commands.

The box, prism, cylinder and rainbow are used to create solid structures, while box0, prism0 and cylinder0 are for hollow structures – just walls without ceiling and floor.You can specify the material – block type and block data – and the dimensions.

Stairs, bed, torch and wallsign are used to place specific elements which must take into account player’s orientation.

The move drone function tells the drone where to move. The last drone position will be remembered so if you want to start again from the player’s position, you have to use move drone reset or Connect user again.

Summon is used to spawn the mobs from the predefined list. You can update this list for new mobs.

At the end of the file there are some variables updated by the Minecraft server: blockType and blockData contain information about the block where the drone is, while result contains the result of last executed command.

If you want to check the values for blockType and blockData, you should insert a delay of at least 0.2 secs (using standard Scratch block) after the last move drone instruction before using them.

Known issues

Sometimes commands are not executed in order, especially when the server is busy. It’s better to avoid launching command sequences from more than one computer at the same time, although it could work.

move drone save_chkpt and move drone goto_chkpt don’t work yet.

Future developments

Hunting for bugs, adding new functions, showing the equivalent Javascript commands on screen.

&

The first solution that I found to make Scratch work together with Minecraft & Scriptcraft, described here, used Node RED to transform http commands sent by Scratch into mqtt packets, brokered by a mosquitto server and finally received by Scriptcraft MQTT extension.

The Node.js script below launches Minecraft server and also creates a very simple http server process that will transfer commands directly to Scriptcraft:

The servers listens to port 8088, the same used by the Scratch extension:

As with the previous setup, the most important part is done using Scriptcraft, the mod created by Walter Higgins that lets you write Minecraft plugins using Javascript.

The /js scratch() call in Node.js script invokes the Javascript function scratch that will interpret the commands received from Scratch. For now it buffers the command until a build instruction is received, then proceeds to execute them in order, inserting also delays based on the complexity of the building instructions (i.e. dimension of impacted areas).

Below is a very basic form of scratch() function working with only one client, that you can paste into a .js file saved in \Scriptcraft\plugins folder.

I’m still looking for a solution to access in Scratch values from Minecraft world. It will make more sense if commands are no more buffered until the build instruction is received, but executed instantly.

Scriptcraft is a fantastic tool for learning JavaScript using Minecraft and also for creating mods. It is very easy to use yet very powerful, giving access to all the functions of the API of your Minecraft server – CanaryMod or Spigot (CraftBukkit).

For younger ones it may be better to start by using a visual tool like Scratch to understand how to use the drone, described as “an (invisible) object you create every time you execute any of the building or movement functions”.

Scriptcraft doesn’t include an http server to listen for commands from an external source, but there is an external module, created also by W Higgins, that can be added to support MQTT protocol – scriptcraft-extras-mqtt. An MQTT broker is also needed, so I used Mosquitto, which is open-source and available for Windows, Mac and Linux.

To enable the use of a Scriptcraft drone, I created a Scratch extension with a few new blocks:

connect – tells the MC server which player will be followed by the drone (the drone is usually created at a player’s location)

drone – controls drone movement

box, box0 – for creating cuboids solid or empty

blockType and blockData are report blocks that return the block at the current drone’s positions

The code for building a pyramid looks like this:

The configuration for Node-RED is not very complex, but I included some extra variables to be able to manage multiple connections. Node-RED adds the IP of the sender to the commands it transmits thru MQTT to MC and the JavaScript functions that process the message use an array of connections, identified by the IP address.

Each user can connect to his MC player on the server and has its own drone to control. He can see the result of drone actions in the MC client window. On users’ computers the only needed components are MC client, Scratch offline and the extension file.

For reading the values of a block type and data Scratch polls the server 30 times per second, while Scriptcraft posts the values (using http) after each build command. Values are also kept in an array, serving correct data based on the IP of the client.

Currently I’m struggling with the out of order execution of drone commands even if they are buffered on the MC server before receiving the “build” command. The same problems occur when reading data. To avoid this I use delays in Scratch programmes but I hope to find a smarter and more reliable solution.

An obvious and quick improvement will be to create blocks that allow choosing the material for a building command from a list, using names instead of numbers for block types, making it easier to use.

ScriptCraft is a plugin created by Walter Higgins for Minecraft servers, that lets you use Javascript within the game for creating mods, mini-games or automating building tasks. It is available for CanaryMod and CraftBukkit (now discontinued ) servers.

You can issue simple commands (precedeed by /js) like

/js echo(1+1)

or create complex functions, saved in scriptcraft\plugins folder, that can be invoked in the same manner:

/js myfunction()

ScriptCraft comes with some extra functions (not part of Javascript language) that can help you in building complex structures. The simplest is box(), used for creating cuboids.

For example,

/js box(blocks.sandstone,3,3,3)

will create a 3x3x3 sandstone cube at the location of the cursor.

There are also functions for prisms, cylinders, spheres and others that you can combine to create your on functions for building complex structures.You are not forced to know the type IDs and data values for Minecraft blocks, as you can use the ScriptCraft predefined blocks object. In the previous example I used blocks.sandstone instead of searching for the numeric value(s) for the specific material.

Using ScriptCraft to teach kids programming

ScriptCraft is a powerful tool for Minecraft modding, but is also very useful to teach kids programming as they can see immediately the result of the issued commands. They can build big structures in seconds (sometimes the server will be overwhelmed by requests to create a box of hundreds blocks on each direction but that’s part of the fun) and they can also easily create simple mods to impress their friends so they surely are motivated to learn.

ScriptCraft comes with an Arrows plugin that modifies arrows to launch fireworks, to explode or to attract a lightning strike on impact, which adds the wow factor. While helping you to keep kids interested, ScriptCraft provides also the opportunity to explain them other related topics. During the installation/configuration I discussed with my 9 years old son about servers, networks, folders structure and similar concepts that he found boring previously. He follows now the JavaScript course on codecademy.com to be able to better use ScriptCraft.

Piper is a complete computer based on Raspberry Pi and contains a customized version of Minecraft that can interact with a DYI controller and external lights.

The Pi comes with a 7″ screen, power bank, mouse, memory card with all needed software and accessories to create your the hardware that interacts with Minecraft – wires, boards, switches, buttons, lights. The player receives in-game instructions for putting them in place and once done he will gain new power-ups.

Photographs, video clips, poetry, personal experiences, objects, memories. Not an exhaustive list but a sample of some of the things English teachers use every day to try and engage students and immerse them in writing tasks. The problem we face is that, for many students, writing feels like work. Not academic work (solving a maths problem or working out an engineering problem) but actual work more attuned with digging the garden or washing up. My job as an English Teacher is to find a way to overcome this and motivate my learners so that they are willing to disregard the work feeling and actually want to write something.

My son is a typical 9 year old reluctant writer. He struggles with his handwriting which makes him slower than his peers at producing written work. He becomes frustrated that his writing doesn’t look like theirs and that he hasn’t…

So you want to learn programming. Maybe you have asked your developer friends for recommendations and get different answers. They explained with terms that you don’t understand (what is object-oriented?!). To help you to pick your first programming language to learn, here is an easy-to-understand infographic that recommends the best option, depending on your purpose and interest. Details such as learning difficulty, popularity, and average salary for each computer programming language are provided too.

Annoyed of students being distracted by their mobile phones? Tired of seeing students falling asleep after a night of gaming? Let’s turn our students from passive consumers of technology into active producers of technology. Let’s get them to develop apps, design games and start their own websites.

Technology is everywhere, if we like it or not. And nearly all future jobs require us to understand it. To respond to this, governments are including computing in national curricula, as a subject taught at all ages but also as part of other subjects. This means the responsibility is on to us, the teachers, because we need to teach it. In the UK already every primary school teacher has to teach computing concepts and in many other countries more and more of us will be required to teach computing or at least integrate computing concepts, ideas and processes into the teacher of our subjects. So let’s get ready for this.

If you are a Computer Science teacher who needs new ideas, tools or resources on how to teach your subject. If you are an Art teacher who suddenly has to talk about website design, user experience and user interfaces in your subject. If you are a Biology teacher who has to teach your students how to programme sensors taking important measurements in an experiment. This MOOC is here to help you. We will be exploring the ideas, concepts, processes and skills that are important in computing and then introduce you to the tools, resources and lesson activities that can help you teach these concepts and processes in the classroom.

The course is designed as an introductory course, for you to use as a starting point to explore some of the ideas and tools further. It is relevant to secondary teachers from all subjects and all levels of experience. A basic amount of knowledge on operating computers and other technology devices is expected but you don’t need prior knowledge of computing. The course lasts for six weeks and requires around 2 hours of work per week. The course has been designed by teachers for teachers and will feature interviews, presentations, and activities from teachers, professors, students and computing professionals.

Enrol in the course and join the discussion on our social media channels via the Facebook group and Twitter using #CScourse