Inheritance: implements pocketmine\inventory\Recipe
 public function onEnable()
 {
     //CraftBug(RecipeBug)
     if (self::ENABLE_CRAFT_BUG) {
         $craftingManager = Server::getInstance()->getCraftingManager();
         $recipes = $craftingManager->getRecipes();
         foreach ($recipes as $recipe) {
             if ($recipe instanceof ShapelessRecipe) {
                 $map = $this->getRecipeMap($recipe);
                 $newRecipe = new ShapedRecipe($recipe->getResult(), $map["map"][0] . $map["map"][1] . $map["map"][2], $map["map"][3] . $map["map"][4] . $map["map"][5], $map["map"][6] . $map["map"][7] . $map["map"][8]);
                 foreach ($map["items"] as $key => $item) {
                     $newRecipe->setIngredient($key, $item);
                 }
                 $craftingManager->registerRecipe($newRecipe);
             }
         }
     }
     if (self::ENABLE_ITEM_DAMAGE_BUG or self::ENABLE_CRAFTING_BUG) {
         Server::getInstance()->getPluginManager()->registerEvents($this, $this);
     }
 }
 private static function writeShapedRecipe(ShapedRecipe $recipe, BinaryStream $stream)
 {
     $stream->putInt($recipe->getWidth());
     $stream->putInt($recipe->getHeight());
     for ($z = 0; $z < $recipe->getHeight(); ++$z) {
         for ($x = 0; $x < $recipe->getWidth(); ++$x) {
             $stream->putSlot($recipe->getIngredient($x, $z));
         }
     }
     $stream->putInt(1);
     $stream->putSlot($recipe->getResult());
     $stream->putUUID($recipe->getId());
     return CraftingDataPacket::ENTRY_SHAPED;
 }
 /**
  * @param ShapedRecipe $recipe
  */
 public function registerShapedRecipe(ShapedRecipe $recipe)
 {
     $result = $recipe->getResult();
     $this->recipes[$recipe->getId()->toBinary()] = $recipe;
     $ingredients = $recipe->getIngredientMap();
     $hash = "";
     foreach ($ingredients as $v) {
         foreach ($v as $item) {
             if ($item !== null) {
                 /** @var Item $item */
                 $hash .= $item->getId() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ",";
             }
         }
         $hash .= ";";
     }
     $this->recipeLookup[$result->getId() . ":" . $result->getDamage()][$hash] = $recipe;
 }