fixed getBlock - issue #40
This commit is contained in:
parent
888ee6c208
commit
9f7b19379b
1 changed files with 10 additions and 2 deletions
|
@ -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(){
|
||||||
|
|
Reference in a new issue