Sniff is a "Scratch-like" programming language that's designed to help Scratchers move gently from Scratch to more conventional languages. They can start writing programs, without having to learn a new language because Sniff is based on Scratch. They learn a little more about variables, compiling, syntax errors (!), and they can have fun controlling real hardware while they're doing it.

Monday, 24 March 2014

Release 5 = Minecraft

The Beta 5 release is now available on the Downloads page, and it contains lots of fixes, and improvements. However the one you're really interested in is Minecraft support!!!

While we love our gadgets, the main concept of Sniff is that its a programming language that lets experienced Scratch users move on to a "written" language that they will be familiar with. The need for this is made clear looking at the Python and Java examples that are provided with the Raspberry Pi version of Minecraft.

Minecraft has been released as a free download for Pi, with an option for external programs to tap into it, so that kids can learn to program by writing scripts to build things inside the 3D world. It's a great idea which is let down by the fact that one look at that examples provided will send any kid running and screaming. They're not particularly complex examples but even for an experienced (non-Python) programmer the syntax,  and code overhead makes them look difficult and hard to follow.

This exactly what Sniff is designed to avoid - Kids already know Scratch, which means that the Sniff syntax is familiar, so they can jump straight into problem solving, and making things! Introducing the Sniff Minecraft Device!

make minecraft device
make message string
make mcX number
make mcY number
make mcZ number
make blockType number
make blockData number

You make minecraft device and its variables like any other Sniff device. This sets up the connection to Pi Minecraft running on the current machine (if you want to use a different machine you can edit lib/Xminecraft.c - not recommended for public editing, but its pretty easy).

Now we can start doing things:

when start
.set message to "Sniff woz here"
.tell minecraft to "show"

broadcasts the message!

.set mcX to 5
.set mxZ to 5
.tell minecraft to "getHeight"
.tell minecraft to "setPos"

Moves the player to square (5,6). However before doing so, it checks the height of the land at that square, which sets mcY to the right value (Y is up) so that the player is standing on the ground rather than flying (or burried!). You can also check the players position with "getPos"

Now lets build a tower:

when start
.set mcX to 0
.set mcY to 0
.set mcZ to 0
.repeat 100
..tell minecraft to "getBlock"
..if blockType = 0
...set blockType to 1
...set blockData to 0
...set blockType to 0
...set blockData to 0
..tell minecraft to "setBlock"
..change mcY by 1
..wait 0.2 secs
.set message to "like my tower?"
.tell minecraft to "show"

We set x/y/z to 0 (the spawn point). We check the block at that position, which gives us the blockType (ID). In addition blockData tells is more about the block ( If the block is currently air (type 0), then we set it to 1 (stone), which builds a tower. If there's already a block there (because we've run the code before) we delete it by setting it to air.

There are other aspects to the Minecraft API, but they either provide duplicate ways of doing things we can already to with these functions, or they're not completely implemented/documented in the current release of minecraft for Pi. If I've missed anything that we should add, then either add it yourself (the files are there for you to change, and we'd love to receive your improvements), or email/DM/leave a comment letting us know.

So what are you waiting for? Go program Minecraft using Scratch like syntax!


  1. Minecraft is a online game which is played by numerous users. You can find out the best minecraft servers by visiting Bisecthosting.

  2. A lot of games will bombard you with various controls, tutorials, how to guides and even beginner guides just to get started with playing the unblocked games

  3. There are two kinds of boys. The first types are those who you would find easily approachable, flirting with girls or completely extrovert and type two are those who like sitting at home, playing games. And unfortunately, type two is more as compared to type one. That's the secret!buy csgo accounts

  4. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post.

  5. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Free Minecraft Players

  6. Sharing such resources can negatively impact on the performance of your gaming world. A dedicated server supports multiple player slots, thus allowing players to expand their online community.minecraft server hosting

  7. Think you can't make money playing your favourite video game? Ever been told that all those hours spent on Minecraft was a waste of time? Well think again, now you too could be making money from home. minecraft windows 10 code

  8. Can I say what relief to uncover somebody that truly knows what theyre referring to on the web. You definitely learn how to bring a concern to light to make it essential. Lots more people ought to look at this and understand this side in the story. I cant believe youre less common because you absolutely possess the gift. Madden Overdrive Coins Hack

  9. A capable engineer called Markus Persson is the man behind Minecraft; the outside the box sandbox building game. download game mod apk

  10. Figure you can't bring in cash playing your preferred computer game? Ever been informed that each one of those hours spent on Minecraft was an exercise in futility?

  11. I like to use Mod Game apps, this is a very nice app, I like it I have downloaded them on, here I see a more quality version. Especially muscle clicker mod apk is my favorite game here.

  12. There are several Minecraft host companies out there that offer a variety of servers for purchase. Many add-ons often consume further resources. In this case, it is crucial to consult your Minecraft host prior to the installation of plugins in order to make sure you have proper resources available.

  13. Runes get a sort of customization to the League of many people play league of legends

  14. I needed to thank you for this incredible read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post.

  15. This is truly a decent and enlightening, containing all data furthermore greatly affects the new innovation. A debt of gratitude is in order for sharing it