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
..else
...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 (http://minecraft.gamepedia.com/Data_values). 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!

21 comments:

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

    ReplyDelete
  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 game.school unblocked games

    ReplyDelete
  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

    ReplyDelete
  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. http://minebrowse.com/

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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? https://serverbrowse.com/minecraft-server-advertising/

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

    ReplyDelete
  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. https://serverbrowse.com/

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

    ReplyDelete
  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. https://serverbrowse.com/

    ReplyDelete
  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 https://pewdiepiemerch.net/pewdiepie-clutch-chair-review/

    ReplyDelete
  16. Minecraft Server Advertising I curious more interest in some of them hope you will give more information on this topics in your next articles.

    ReplyDelete
  17. This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: Minecraft Server Advertising

    ReplyDelete
  18. We are tied directly into the sate’s renewal database which allows us to process your request almost instantly. Minecraft Advertising Services

    ReplyDelete
  19. Many sites just like MMOGAH have managed to supply the desire to buy osrs gold securely on the web so you could have an edge over all the online players around you. Via trading along with exchanging, game enthusiasts could receive ample gold in their accounts giving them an outstanding experience buy osrs gold in the video game. To receive old school runescape gold, it was earlier considered as a major challenge although now people can get it very easily on MMOGAH.

    ReplyDelete
  20. Additionally, a person receives 60 power volumes of the exceptional personality in the game and also players will find 8 races as well as nine modules in the game which helps to really make the online game more amusing. There are plenty of features in the game such as high-quality graphics, best sound quality, plus much more. A player can easily select the best performing persona within classic wow gold the game and game enthusiasts could also find a number of significant things in this incredible game including weaponry, equipment, tools, and much more.

    ReplyDelete
  21. Whatever the task, whether it's a game or something else, you can enjoy it only when you are free from the hassle of writing. Masters Dissertation Writing Services is the one which can write your academic work at affordable rates.

    ReplyDelete