From 8fe3f6ef1b8af15e48b74c3484f56dbf75fd078a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Nov 2018 17:13:35 +0000 Subject: [PATCH] Player now drops the contents of temporary inventories these inventories are just glorified crafting tables. --- src/pocketmine/inventory/AnvilInventory.php | 5 ++++- src/pocketmine/inventory/EnchantInventory.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/inventory/AnvilInventory.php b/src/pocketmine/inventory/AnvilInventory.php index 7d74fdc01..c13d87251 100644 --- a/src/pocketmine/inventory/AnvilInventory.php +++ b/src/pocketmine/inventory/AnvilInventory.php @@ -59,6 +59,9 @@ class AnvilInventory extends ContainerInventory{ public function onClose(Player $who) : void{ parent::onClose($who); - $this->dropContents($this->holder->getLevel(), $this->holder->add(0.5, 0.5, 0.5)); + foreach($this->getContents() as $item){ + $who->dropItem($item); + } + $this->clearAll(); } } diff --git a/src/pocketmine/inventory/EnchantInventory.php b/src/pocketmine/inventory/EnchantInventory.php index e6f9cf118..059b229b6 100644 --- a/src/pocketmine/inventory/EnchantInventory.php +++ b/src/pocketmine/inventory/EnchantInventory.php @@ -59,6 +59,9 @@ class EnchantInventory extends ContainerInventory{ public function onClose(Player $who) : void{ parent::onClose($who); - $this->dropContents($this->holder->getLevel(), $this->holder->add(0.5, 0.5, 0.5)); + foreach($this->getContents() as $item){ + $who->dropItem($item); + } + $this->clearAll(); } }