diff --git a/src/pocketmine/inventory/transaction/CraftingTransaction.php b/src/pocketmine/inventory/transaction/CraftingTransaction.php index f98d38fb9..0b4fa7fd0 100644 --- a/src/pocketmine/inventory/transaction/CraftingTransaction.php +++ b/src/pocketmine/inventory/transaction/CraftingTransaction.php @@ -61,8 +61,8 @@ class CraftingTransaction extends InventoryTransaction{ if($this->inputs[$y][$x]->isNull()){ $this->inputs[$y][$x] = clone $item; - }else{ - throw new \RuntimeException("Input $index has already been set"); + }elseif(!$this->inputs[$y][$x]->equals($item)){ + throw new \RuntimeException("Input $index has already been set and does not match the current item (expected " . $this->inputs[$y][$x] . ", got " . $item . ")"); } } @@ -76,8 +76,8 @@ class CraftingTransaction extends InventoryTransaction{ if($this->secondaryOutputs[$y][$x]->isNull()){ $this->secondaryOutputs[$y][$x] = clone $item; - }else{ - throw new \RuntimeException("Output $index has already been set"); + }elseif(!$this->secondaryOutputs[$y][$x]->equals($item)){ + throw new \RuntimeException("Output $index has already been set and does not match the current item (expected " . $this->secondaryOutputs[$y][$x] . ", got " . $item . ")"); } } @@ -88,8 +88,8 @@ class CraftingTransaction extends InventoryTransaction{ public function setPrimaryOutput(Item $item) : void{ if($this->primaryOutput === null){ $this->primaryOutput = clone $item; - }else{ - throw new \RuntimeException("Primary result item has already been set"); + }elseif(!$this->primaryOutput->equals($item)){ + throw new \RuntimeException("Primary result item has already been set and does not match the current item (expected " . $this->primaryOutput . ", got " . $item . ")"); } }