22declare(strict_types=1);
24namespace pocketmine\crafting;
32 private array $ingredients = [];
34 private array $results;
35 private ShapelessRecipeType $type;
41 public function __construct(array $ingredients, array $results, ShapelessRecipeType $type){
44 if(count($ingredients) > 9){
45 throw new \InvalidArgumentException(
"Shapeless recipes cannot have more than 9 ingredients");
47 $this->ingredients = $ingredients;
55 return
Utils::cloneObjectArray($this->results);
59 return $this->getResults();
62 public function getType() : ShapelessRecipeType{
70 return $this->ingredients;
73 public function getIngredientCount() : int{
74 return count($this->ingredients);
79 $input = $grid->getContents();
81 foreach($this->ingredients as $ingredient){
82 foreach($input as $j => $haveItem){
83 if($ingredient->accepts($haveItem)){
92 return count($input) === 0;
getResultsFor(CraftingGrid $grid)
__construct(array $ingredients, array $results, ShapelessRecipeType $type)
matchesCraftingGrid(CraftingGrid $grid)
static cloneObjectArray(array $array)