22declare(strict_types=1);
24namespace pocketmine\inventory\transaction\action;
36 public function __construct(
38 private int $inventorySlot,
42 parent::__construct($sourceItem, $targetItem);
49 return $this->inventory;
56 return $this->inventorySlot;
65 if(!$this->inventory->slotExists($this->inventorySlot)){
68 if(!$this->inventory->getItem($this->inventorySlot)->equalsExact($this->sourceItem)){
71 if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
74 if($this->targetItem->getCount() > $this->inventory->getMaxStackSize()){
75 throw new TransactionValidationException(
"Target item exceeds inventory max stack size");
83 $transaction->addInventory($this->inventory);
90 $this->inventory->setItem($this->inventorySlot, $this->targetItem);
onAddToTransaction(InventoryTransaction $transaction)