diff --git a/src/pocketmine/inventory/transaction/action/DropItemAction.php b/src/pocketmine/inventory/transaction/action/DropItemAction.php index 4109fe73c..98e0be68b 100644 --- a/src/pocketmine/inventory/transaction/action/DropItemAction.php +++ b/src/pocketmine/inventory/transaction/action/DropItemAction.php @@ -24,6 +24,8 @@ declare(strict_types=1); namespace pocketmine\inventory\transaction\action; use pocketmine\event\player\PlayerDropItemEvent; +use pocketmine\item\Item; +use pocketmine\item\ItemFactory; use pocketmine\Player; /** @@ -31,15 +33,12 @@ use pocketmine\Player; */ class DropItemAction extends InventoryAction{ - /** - * Verifies that the source item of a drop-item action must be air. This is not strictly necessary, just a sanity - * check. - * - * @param Player $source - * @return bool - */ + public function __construct(Item $targetItem){ + parent::__construct(ItemFactory::get(Item::AIR, 0, 0), $targetItem); + } + public function isValid(Player $source) : bool{ - return $this->sourceItem->isNull(); + return true; } public function onPreExecute(Player $source) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/types/NetworkInventoryAction.php b/src/pocketmine/network/mcpe/protocol/types/NetworkInventoryAction.php index 0373ee7c5..caab97964 100644 --- a/src/pocketmine/network/mcpe/protocol/types/NetworkInventoryAction.php +++ b/src/pocketmine/network/mcpe/protocol/types/NetworkInventoryAction.php @@ -170,7 +170,7 @@ class NetworkInventoryAction{ throw new \UnexpectedValueException("Only expecting drop-item world actions from the client!"); } - return new DropItemAction($this->oldItem, $this->newItem); + return new DropItemAction($this->newItem); case self::SOURCE_CREATIVE: switch($this->inventorySlot){ case self::ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM: