Hi, I want to make a custom crafting recipe that require custom items with name I'm making an rpg plugins, and want to add crafting feature on my plugins, so player can craft RPG items from the crafting table. is it possible? if yes, can you make an example of it? Thanks
theoretically possible using names would be a big implication as players could rename things Or you would have to disable renaming... i am not sure but maybe NBT works if PMMP does deep compare
It's all fairly well documented in the source code: ShapedRecipe CraftingManager->registerShapedRecipe Server->getCraftingManager If you want to register a shapeless recipe, you use CraftingManager->registerShapelessRecipe with an instance of ShapelessRecipe.
So Shapeless recipe is a recipe that require another item but with no shape? PHP: $recipe = new ShapelessRecipe(Item::get(286, 1, 1, $nbt));$recipe->addIngredient($x, $y, Item $item); What are $x, $y on AddIngredient
Did i do it right? PHP: $recipe = new ShapelessRecipe(Item::get(286, 1, 1));$recipe->addIngredient($x, $y, Item::get(276, 1, 1));$this->getServer()->getCraftingManager()->registerShapelessRecipe($recipe);
Code: [08:47:14] [Server thread/CRITICAL]: Error: "Call to a member function toBinary() on null" (EXCEPTION) in "/src/pocketmine/inventory/CraftingManager" at line 218 i dont know what to do PHP: $recipe = new ShapelessRecipe(Item::get(286, 1, 1));$recipe->addIngredient(Item::get(276, 1, 1));$recipe->addIngredient(Item::get(276, 1, 1));$this->getServer()->getCraftingManager()->registerShapelessRecipe($recipe);
i don't know if am right or wrong but i suppose since your making a new recipe you need another file with the recipe blocks etc?
Use: PHP: $recipe = new ShapelessRecipe(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->registerToCraftingManager();
PHP: $recipe = new ShapelessRecipe(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$recipe->addIngredient(Item::get(1,0,1));$this->getServer()->getCraftingManager()->registerRecipe($recipe) It worked, but when i try to craft it from crafting table, the items goes back
ShapelessRecipe is for the 2x2 crafting window. If you are looking to use more than 4 items, you need to use BigShapelessRecipe