Hopper: add more boilerplate code to fix inventory leak

This commit is contained in:
Dylan K. Taylor 2019-06-03 19:17:13 +01:00
parent 7a05c46ff6
commit 56a4e8c032

View File

@ -60,6 +60,15 @@ class Hopper extends Spawnable implements Container, Nameable{
$nbt->setInt(self::TAG_TRANSFER_COOLDOWN, $this->transferCooldown);
}
public function close() : void{
if(!$this->closed){
$this->inventory->removeAllViewers(true);
$this->inventory = null;
parent::close();
}
}
public function getDefaultName() : string{
return "Hopper";
}