diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 755e289fe..fd5136dac 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -38,23 +38,31 @@ define("BLOCK_UPDATE_WEAK", 3); class BlockAPI{ private $server; - public static function fromString($str){ - $b = explode(":", str_replace(" ", "_", trim($str))); - if(!isset($b[1])){ - $meta = 0; + 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{ - $meta = ((int) $b[1]) & 0xFFFF; - } - - if(defined(strtoupper($b[0]))){ - $item = BlockAPI::getItem(constant(strtoupper($b[0])), $meta); - if($item->getID() === AIR and strtoupper($b[0]) !== "AIR"){ + $b = explode(":", str_replace(" ", "_", trim($str))); + if(!isset($b[1])){ + $meta = 0; + }else{ + $meta = ((int) $b[1]) & 0xFFFF; + } + + if(defined(strtoupper($b[0]))){ + $item = BlockAPI::getItem(constant(strtoupper($b[0])), $meta); + if($item->getID() === AIR and strtoupper($b[0]) !== "AIR"){ + $item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta); + } + }else{ $item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta); } - }else{ - $item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta); + return $item; } - return $item; } public static function get($id, $meta = 0, $v = false){ diff --git a/src/config.php b/src/config.php index 1153e0fb7..8b6c30146 100644 --- a/src/config.php +++ b/src/config.php @@ -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"); \ No newline at end of file