Heap of bugfixes, cleanup and PHP 7 upgrades

This commit is contained in:
Dylan K. Taylor
2017-07-13 19:18:56 +01:00
parent c2a7c2c6cd
commit 2a7b736f18
49 changed files with 114 additions and 148 deletions

View File

@ -256,12 +256,12 @@ class CraftingManager{
}
$hasRecipe = null;
foreach($this->recipeLookup[$idx] as $recipe){
if($recipe instanceof ShapelessRecipe){
if($recipe->getIngredientCount() !== count($ingredients)){
foreach($this->recipeLookup[$idx] as $possibleRecipe){
if($possibleRecipe instanceof ShapelessRecipe){
if($possibleRecipe->getIngredientCount() !== count($ingredients)){
continue;
}
$checkInput = $recipe->getIngredientList();
$checkInput = $possibleRecipe->getIngredientList();
foreach($ingredients as $item){
$amount = $item->getCount();
foreach($checkInput as $k => $checkItem){
@ -280,7 +280,7 @@ class CraftingManager{
}
if(count($checkInput) === 0){
$hasRecipe = $recipe;
$hasRecipe = $possibleRecipe;
break;
}
}

View File

@ -137,7 +137,7 @@ class ShapedRecipe implements Recipe{
* @return null|Item
*/
public function getIngredient($x, $y){
return isset($this->ingredients[$y][$x]) ? $this->ingredients[$y][$x] : Item::get(Item::AIR);
return $this->ingredients[$y][$x] ?? Item::get(Item::AIR);
}
/**

View File

@ -28,36 +28,36 @@ interface TransactionGroup{
/**
* @return float
*/
function getCreationTime();
public function getCreationTime();
/**
* @return Transaction[]
*/
function getTransactions();
public function getTransactions();
/**
* @return Inventory[]
*/
function getInventories();
public function getInventories();
/**
* @param Transaction $transaction
*/
function addTransaction(Transaction $transaction);
public function addTransaction(Transaction $transaction);
/**
* @return bool
*/
function canExecute();
public function canExecute();
/**
* @return bool
*/
function execute();
public function execute();
/**
* @return bool
*/
function hasExecuted();
public function hasExecuted();
}