Saturday, February 23, 2013

Build Giant Ravine in Minecraft using ScriptCraft (with other examples)

Minecraft is a huge game.  The full PC version is especially great because it is customizable with lots of mods available all over the internet.  One great new mod is ScriptCraft by Walter Higgins ( ScriptCraft runs on a bukkit version of the minecraft server.  Installation is covered on the ServerCraft site.

ScriptCraft adds javascript control of minecraft.  Buildings and other objects can be created instantly through the Minecraft command line.  Also this can be a great way to introduce someone into programming for the first time.

Try these samples below.  Copy these javascript sources to your server and restart it to try them out.

Save as igloo.js and put in your js-plugins\drone folder.

load(__folder + "drone.js")
// constructs an igloo
Drone.extend('igloo', function () {
//make basic structure
this.hemisphere0(blocks.snow, 7, 'north');
//clear door
this.up(2);, 2, 3, 2);
return this.move('igloo');

Run this by typing in the Minecraft command line

/js igloo()

Save as enchant_table.js and put in your js-plugins\drone folder.

load(__folder + "drone.js")
// constructs an enchantment table surrounded with books for max enchanting
Drone.extend('enchant_table', function () {
this.up(); //set to just above floor level.
this.box0(blocks.bookshelf, 5, 5, 4);
//open side
this.box0(0, 3, 3, 1);
//add enchantment table
//add floor
this.move('enchant_table');, 5, 1, 4);
//add roof
this.up(4);, 5, 1, 4);

return this;

Run this by typing in the Minecraft command line

/js enchant_table()

Now you'll have a enchantment table that is fully maxed out.

One of my favorite things to do with this is to use the command to explore and reveal to world underneath.  So to clear out large areas in this snow covered forest, issue a command like down(height/2).box(blocktype, width, height, depth) with 0 for the block type.

/js down(40).box(0, 20, 70, 120)

Now just look at the giant ravine we've created.  This method reveals all sort of neat areas to explore and is great for mining.

The box(...) part of the function is what actually clears the area out since we are using air (block 0) as the block.  Since box() always goes up, we need to send the command down with the down(40) command first.  Since we are using javascript we can chain the commands together as shown above.

What kind of cool things are you doing?  Please send me a note if you've enjoyed this page.

Some of the ScriptCraft built in samples to try:
/js castle()
/js chessboard()
/js cottage()
/js cottage_road()
/js dancefloor()
/js fort()
/js rainbow()
/js temple()

To create with other block types, use the (dec) values from the official Minecraft list: