public function __construct(array $shape, array $ingredients, array $results, int $priority = 50){
$this->height = count($shape);
if($this->height > 3 or $this->height <= 0){
throw new InvalidArgumentException("Shaped recipes may only have 1, 2 or 3 rows, not $this->height");
}
$shape = array_values($shape);
$this->width = strlen($shape[0]);
if($this->width > 3 or $this->width <= 0){
throw new InvalidArgumentException("Shaped recipes may only have 1, 2 or 3 columns, not $this->width");
}
foreach($shape as $y => $row){
if(strlen($row) !== $this->width){
throw new InvalidArgumentException("Shaped recipe rows must all have the same length (expected $this->width, got " . strlen($row) . ")");
}
for($x = 0; $x < $this->width; ++$x){
if($row[$x] !== ' ' and !isset($ingredients[$row[$x]])){
throw new InvalidArgumentException("No item specified for symbol '" . $row[$x] . "'");
}
}
}
$this->shape = $shape;
foreach($ingredients as $char => $i){
$this->setIngredient($char, $i);
}
$this->results = array_map(function(Item $item) : Item{ return clone $item; }, $results);
$this->priority = $priority;
}
Мой код:
$this->getServer()->getCraftingManager()->registerRecipe((new ShapedRecipe($item, 1, 3, 3))->addIngredient(0, 0, Item::get(377, 0, 1))->addIngredient(0, 1, Item::get(46, 0, 1))->addIngredient(0, 2, Item::get(377, 0, 1))->addIngredient(1, 0, Item::get(46, 0, 1))->addIngredient(1, 1, Item::get(331, 0, 1))->addIngredient(2, 1, Item::get(46, 0, 1))->addIngredient(2, 0, Item::get(377, 0, 1))->addIngredient(1, 2, Item::get(46, 0, 1))->addIngredient(2, 2, Item::get(377, 0, 1)));
Ошибка: [09:29:22.710] [Server thread/CRITICAL]: TypeError: “pocketmine\inventory\ShapedRecipe::__construct(): Argument #1 ($shape) must be of type array, pocketmine\item\ItemBlock given, called in /root/srv/plugins/Plugin/src/plugin/plugin/Main.php on line 448” (EXCEPTION) in “/root/srv/src/pocketmine/inventory/ShapedRecipe.php”