Get Item Lists from BlockAPI::fromString() method

This commit is contained in:
Shoghi Cervantes Pueyo 2013-03-06 16:43:25 +01:00
parent 6c4900cd32
commit e8c2662258
2 changed files with 22 additions and 14 deletions

View File

@ -38,7 +38,14 @@ define("BLOCK_UPDATE_WEAK", 3);
class BlockAPI{
private $server;
public static function fromString($str){
public static function fromString($str, $multiple = false){
if($multiple === true){
$blocks = array();
foreach(explode(",",$str) as $b){
$blocks[] = BlockAPI::fromString($b, false);
}
return $blocks;
}else{
$b = explode(":", str_replace(" ", "_", trim($str)));
if(!isset($b[1])){
$meta = 0;
@ -56,6 +63,7 @@ class BlockAPI{
}
return $item;
}
}
public static function get($id, $meta = 0, $v = false){
$id = (int) $id;

View File

@ -47,5 +47,5 @@ define("MAJOR_VERSION", "Alpha_1.3dev");
define("CURRENT_STRUCTURE", 5);
define("CURRENT_PROTOCOL", 9);
define("CURRENT_MINECRAFT_VERSION", "v0.6.1 alpha");
define("CURRENT_API_VERSION", 3);
define("CURRENT_API_VERSION", 4);
define("CURRENT_PHP_VERSION", "5.4.12");