Fixed ShapedRecipe constructor

This commit is contained in:
PEMapModder 2016-02-07 01:02:40 +08:00
parent e597314331
commit 1082e32fd7

View File

@ -22,9 +22,9 @@
namespace pocketmine\inventory;
use pocketmine\item\Item;
use pocketmine\math\Vector2;
use pocketmine\Server;
use pocketmine\utils\UUID;
use pocketmine\math\Vector2;
class ShapedRecipe implements Recipe{
/** @var Item */
@ -49,8 +49,8 @@ class ShapedRecipe implements Recipe{
*/
public function __construct(Item $result, $height, $width){
for($h = 0; $h < $height; $h++){
if(strlen($width) === 0 or strlen($width) > 3){
throw new \InvalidStateException("Crafting rows should be 1, 2, 3 characters, not " . count($row));
if($width === 0 or $width > 3){
throw new \InvalidStateException("Crafting rows should be 1, 2, 3 wide, not $width");
}
$this->ingredients[] = array_fill(0, $width, null);
}