34 public function __construct(
private Item $item){
36 throw new \InvalidArgumentException(
"Recipe ingredients must not be air items");
38 if($item->getCount() !== 1){
39 throw new \InvalidArgumentException(
"Recipe ingredients cannot require count");
41 $this->item = clone $item;
44 public function getItem() :
Item{
return clone $this->item; }
46 public function accepts(
Item $item) :
bool{
50 return $item->getCount() >= 1 && $this->item->equals($item,
true, $this->item->
hasNamedTag());
53 public function __toString() :
string{
54 return "ExactRecipeIngredient(" . $this->item .
")";