Skip to content

Instantly share code, notes, and snippets.

@paulharter
paulharter / craftscript_utils.js
Created January 14, 2013 13:50
Some handy utility functions I came up with working with Minecraft craftscripts
/*
Some handy utility functions I came up with working with Minecraft craftscripts
*/
// exec
// performs a java exec by getting the java runtime by name
exec = function name(cmd){
var cRuntime = java.lang.Class.forName("java.lang.Runtime");
var mGetRuntime = cRuntime.getMethod("getRuntime");
@paulharter
paulharter / print.js
Created November 2, 2012 14:04
printcraft - this is the js craftscript code used for mc.printcraft.org - it writes out an OpenSCAD file
importPackage(Packages.com.sk89q.worldedit.blocks);
importPackage(Packages.com.sk89q.worldedit);
//joins up blocks in the dimension dim
function squash(blockarray, dim, arraysize){
var i = new Array();
var dims = new Array();
for (var y = 0; y <= arraysize*2; y++){