66 $inventory = $this->inventoryWindow->getInventory();
67 if(!$inventory->slotExists($this->inventorySlot)){
68 throw new TransactionValidationException(
"Slot does not exist");
70 if(!$inventory->getItem($this->inventorySlot)->equalsExact($this->sourceItem)){
71 throw new TransactionValidationException(
"Slot does not contain expected original item");
73 if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
74 throw new TransactionValidationException(
"Target item exceeds item type max stack size");
76 if($this->targetItem->getCount() > $inventory->getMaxStackSize()){
77 throw new TransactionValidationException(
"Target item exceeds inventory max stack size");
80 foreach($inventory->getSlotValidators() as $validator){
81 $ret = $validator->validate($inventory, $this->targetItem, $this->inventorySlot);
83 throw new TransactionValidationException(
"Target item is not accepted by the inventory at slot #" . $this->inventorySlot .
": " . $ret->getMessage(), 0, $ret);