fixed getBlock - issue #40

This commit is contained in:
walterhiggins 2013-01-25 00:07:39 +00:00
parent 888ee6c208
commit 9f7b19379b

View file

@ -66,12 +66,20 @@ var global = this;
var block = _getBlockObject(x,y,z); var block = _getBlockObject(x,y,z);
if (block) if (block)
return "" + block.typeId + ":" + block.data; return "" + block.typeId + ":" + block.data;
}; };
var _getBlockObject = function(x,y,z){ var _getBlockObject = function(x,y,z){
var world = _getWorld(); var world = _getWorld();
if (world) if (world){
return world.getBlockAt(x,y,z); if (typeof z == "undefined"){
var loc = _getMousePos()
if (loc)
return world.getBlockAt(loc);
}else{
return world.getBlockAt(x,y,z);
}
}
}; };
var _getWorld = function(){ var _getWorld = function(){