/** * @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; }