Player now drops the contents of temporary inventories

these inventories are just glorified crafting tables.
This commit is contained in:
Dylan K. Taylor 2018-11-25 17:13:35 +00:00
parent a9a647855b
commit 8fe3f6ef1b
2 changed files with 8 additions and 2 deletions

View File

@ -59,6 +59,9 @@ class AnvilInventory extends ContainerInventory{
public function onClose(Player $who) : void{ public function onClose(Player $who) : void{
parent::onClose($who); 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();
} }
} }

View File

@ -59,6 +59,9 @@ class EnchantInventory extends ContainerInventory{
public function onClose(Player $who) : void{ public function onClose(Player $who) : void{
parent::onClose($who); 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();
} }
} }