Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor
2022-03-02 18:43:34 +00:00
13 changed files with 92 additions and 45 deletions

View File

@ -148,18 +148,20 @@ class BrewingStand extends Spawnable implements Container, Nameable{
* @phpstan-return array<int, BrewingRecipe>
*/
private function getBrewableRecipes() : array{
if($this->inventory->getItem(BrewingStandInventory::SLOT_INGREDIENT)->isNull()){
$ingredient = $this->inventory->getItem(BrewingStandInventory::SLOT_INGREDIENT);
if($ingredient->isNull()){
return [];
}
$recipes = [];
$craftingManager = $this->position->getWorld()->getServer()->getCraftingManager();
foreach([BrewingStandInventory::SLOT_BOTTLE_LEFT, BrewingStandInventory::SLOT_BOTTLE_MIDDLE, BrewingStandInventory::SLOT_BOTTLE_RIGHT] as $slot){
$input = $this->inventory->getItem($slot);
if($input->isNull()){
continue;
}
if(($recipe = $this->position->getWorld()->getServer()->getCraftingManager()->matchBrewingRecipe($input, $this->inventory->getItem(BrewingStandInventory::SLOT_INGREDIENT))) !== null){
if(($recipe = $craftingManager->matchBrewingRecipe($input, $ingredient)) !== null){
$recipes[$slot] = $recipe;
}
}