mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
fix some inspections related to crafting recipes
This commit is contained in:
@ -31,6 +31,7 @@ class ShapelessRecipe implements Recipe{
|
||||
/** @var Item */
|
||||
private $output;
|
||||
|
||||
/** @var UUID|null */
|
||||
private $id = null;
|
||||
|
||||
/** @var Item[] */
|
||||
@ -40,10 +41,16 @@ class ShapelessRecipe implements Recipe{
|
||||
$this->output = clone $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UUID|null
|
||||
*/
|
||||
public function getId(){
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UUID $id
|
||||
*/
|
||||
public function setId(UUID $id){
|
||||
if($this->id !== null){
|
||||
throw new \InvalidStateException("Id is already set");
|
||||
@ -52,14 +59,14 @@ class ShapelessRecipe implements Recipe{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getResult(){
|
||||
public function getResult() : Item{
|
||||
return clone $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Item $item
|
||||
*
|
||||
* @returns ShapelessRecipe
|
||||
* @return ShapelessRecipe
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
@ -101,7 +108,7 @@ class ShapelessRecipe implements Recipe{
|
||||
/**
|
||||
* @return Item[]
|
||||
*/
|
||||
public function getIngredientList(){
|
||||
public function getIngredientList() : array{
|
||||
$ingredients = [];
|
||||
foreach($this->ingredients as $ingredient){
|
||||
$ingredients[] = clone $ingredient;
|
||||
@ -113,7 +120,7 @@ class ShapelessRecipe implements Recipe{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIngredientCount(){
|
||||
public function getIngredientCount() : int{
|
||||
$count = 0;
|
||||
foreach($this->ingredients as $ingredient){
|
||||
$count += $ingredient->getCount();
|
||||
|
Reference in New Issue
Block a user