diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index af0c56665..65476f7a5 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -54,30 +54,26 @@ class CraftingManager{ switch($recipe["type"]){ case 0: // TODO: handle multiple result items - if(count($recipe["output"]) === 1){ - $first = $recipe["output"][0]; - $result = new ShapelessRecipe(Item::get($first["id"], $first["damage"], $first["count"], $first["nbt"])); + $first = $recipe["output"][0]; + $result = new ShapelessRecipe(Item::get($first["id"], $first["damage"], $first["count"], $first["nbt"])); - foreach($recipe["input"] as $ingredient){ - $result->addIngredient(Item::get($ingredient["id"], $ingredient["damage"], $ingredient["count"], $first["nbt"])); - } - $this->registerRecipe($result); + foreach($recipe["input"] as $ingredient){ + $result->addIngredient(Item::get($ingredient["id"], $ingredient["damage"], $ingredient["count"], $first["nbt"])); } + $this->registerRecipe($result); break; case 1: // TODO: handle multiple result items - if(count($recipe["output"]) === 1){ - $first = $recipe["output"][0]; - $result = new ShapedRecipe(Item::get($first["id"], $first["damage"], $first["count"], $first["nbt"]), $recipe["height"], $recipe["width"]); + $first = $recipe["output"][0]; + $result = new ShapedRecipe(Item::get($first["id"], $first["damage"], $first["count"], $first["nbt"]), $recipe["height"], $recipe["width"]); - $shape = array_chunk($recipe["input"], $recipe["width"]); - foreach($shape as $y => $row){ - foreach($row as $x => $ingredient){ - $result->addIngredient($x, $y, Item::get($ingredient["id"], ($ingredient["damage"] < 0 ? -1 : $ingredient["damage"]), $ingredient["count"], $ingredient["nbt"])); - } + $shape = array_chunk($recipe["input"], $recipe["width"]); + foreach($shape as $y => $row){ + foreach($row as $x => $ingredient){ + $result->addIngredient($x, $y, Item::get($ingredient["id"], ($ingredient["damage"] < 0 ? -1 : $ingredient["damage"]), $ingredient["count"], $ingredient["nbt"])); } - $this->registerRecipe($result); } + $this->registerRecipe($result); break; case 2: case 3: