ShapelessRecipe: make type parameter mandatory

This commit is contained in:
Dylan K. Taylor 2022-12-15 21:41:33 +00:00
parent 4d79aced07
commit ba4d038972
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -37,11 +37,9 @@ class ShapelessRecipe implements CraftingRecipe{
/**
* @param RecipeIngredient[] $ingredients No more than 9 total. This applies to sum of item stack counts, not count of array.
* @param Item[] $results List of result items created by this recipe.
*
* TODO: we'll want to make the type parameter mandatory in PM5
*/
public function __construct(array $ingredients, array $results, ?ShapelessRecipeType $type = null){
$this->type = $type ?? ShapelessRecipeType::CRAFTING();
public function __construct(array $ingredients, array $results, ShapelessRecipeType $type){
$this->type = $type;
if(count($ingredients) > 9){
throw new \InvalidArgumentException("Shapeless recipes cannot have more than 9 ingredients");