I tried the following but it did'nt work. :/ PHP: $test = Item::get(1, 0, 1); $test->setCustomName(TextFormat::RESET . TextFormat::GREEN . "Test-Item"); $recipe = new ShapedRecipe($test, 3, 3); $recipe->addIngredient(0, 0, Item::get(0, 0, 0)); $recipe->addIngredient(0, 1, Item::get(0, 0, 0)); $recipe->addIngredient(0, 2, Item::get(0, 0, 0)); $recipe->addIngredient(1, 0, Item::get(0, 0, 0)); $recipe->addIngredient(1, 1, Item::get(377, 0, 0)); $recipe->addIngredient(1, 2, Item::get(0, 0, 0)); $recipe->addIngredient(2, 0, Item::get(265, 0, 0)); $recipe->addIngredient(2, 1, Item::get(374, 0, 1)); $recipe->addIngredient(2, 2, Item::get(265, 0, 0)); $this->plugin->getServer()->getCraftingManager()->registerRecipe($recipe); Error: Code: [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\inventory\ShapedRecipe::__construct() must be of the type array, object given, called in /home/Server/plugins/Plugin/src/Nick/Main.php on line 27" (EXCEPTION) in "src/pocketmine/inventory/ShapedRecipe" at line 57 Please help me
I don't know if I am right but $test = Item::get(1, 0, 1); it mean that you already do your "array". 1, 0, 1. few lines after, you write $recipe = new ShapedRecipe($test, 3, 3); so basically, your line mean $recipe = new ShapedRecipe(Item::get(1, 0, 1), 3, 3); Try that $recipe = new ShapedRecipe(Item::get(1, 0, 1)); or this $test = Item::get(1, 0, 1); $recipe = new ShapedRecipe($test);
Yes. Both of the lines do the exact same thing but I already got issues with putting the value as a variable (like $test) in the (). So try both, if the variable way work fine, welp that's good Ig lol.