addShapedRecipe() public method

public addShapedRecipe ( ShapedRecipe $recipe )
$recipe pocketmine\inventory\ShapedRecipe
Example #1
0
 public function sendRecipeList(Player $p)
 {
     $pk = new CraftingDataPacket();
     $pk->cleanRecipes = true;
     foreach ($this->getCraftingManager()->getRecipes() as $recipe) {
         if ($recipe instanceof ShapedRecipe) {
             $pk->addShapedRecipe($recipe);
         } elseif ($recipe instanceof ShapelessRecipe) {
             $pk->addShapelessRecipe($recipe);
         }
     }
     foreach ($this->getCraftingManager()->getFurnaceRecipes() as $recipe) {
         $pk->addFurnaceRecipe($recipe);
     }
     $p->dataPacket($pk);
 }
Example #2
0
 public function generateRecipeList()
 {
     $pk = new CraftingDataPacket();
     $pk->cleanRecipes = true;
     foreach ($this->getCraftingManager()->getRecipes() as $recipe) {
         if ($recipe instanceof ShapedRecipe) {
             $pk->addShapedRecipe($recipe);
         } elseif ($recipe instanceof ShapelessRecipe) {
             $pk->addShapelessRecipe($recipe);
         }
     }
     foreach ($this->getCraftingManager()->getFurnaceRecipes() as $recipe) {
         $pk->addFurnaceRecipe($recipe);
     }
     $pk->encode();
     $pk->isEncoded = true;
     $this->recipeList = $pk;
 }