Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor
2020-02-10 11:40:08 +00:00
539 changed files with 3706 additions and 6211 deletions

View File

@@ -46,6 +46,9 @@ class ShapelessRecipe implements CraftingRecipe{
$this->results = array_map(function(Item $item) : Item{ return clone $item; }, $results);
}
/**
* @return Item[]
*/
public function getResults() : array{
return array_map(function(Item $item) : Item{ return clone $item; }, $this->results);
}
@@ -55,10 +58,6 @@ class ShapelessRecipe implements CraftingRecipe{
}
/**
* @param Item $item
*
* @return ShapelessRecipe
*
* @throws \InvalidArgumentException
*/
public function addIngredient(Item $item) : ShapelessRecipe{
@@ -74,8 +73,6 @@ class ShapelessRecipe implements CraftingRecipe{
}
/**
* @param Item $item
*
* @return $this
*/
public function removeIngredient(Item $item){
@@ -99,9 +96,6 @@ class ShapelessRecipe implements CraftingRecipe{
return array_map(function(Item $item) : Item{ return clone $item; }, $this->ingredients);
}
/**
* @return int
*/
public function getIngredientCount() : int{
$count = 0;
foreach($this->ingredients as $ingredient){
@@ -120,11 +114,6 @@ class ShapelessRecipe implements CraftingRecipe{
$manager->registerShapelessRecipe($this);
}
/**
* @param CraftingGrid $grid
*
* @return bool
*/
public function matchesCraftingGrid(CraftingGrid $grid) : bool{
//don't pack the ingredients - shapeless recipes require that each ingredient be in a separate slot
$input = $grid->getContents();
@@ -140,6 +129,6 @@ class ShapelessRecipe implements CraftingRecipe{
return false; //failed to match the needed item to a given item
}
return empty($input); //crafting grid should be empty apart from the given ingredient stacks
return count($input) === 0; //crafting grid should be empty apart from the given ingredient stacks
}
}