Fixed crash when chests are closed with viewers

This commit is contained in:
Shoghi Cervantes 2014-09-01 02:26:23 +02:00
parent 705e4da789
commit cc2555bb88
2 changed files with 22 additions and 0 deletions

View File

@ -58,6 +58,19 @@ class Chest extends Spawnable implements InventoryHolder, Container{
$this->checkPairing();
}
public function close(){
if($this->closed === false){
foreach($this->getInventory()->getViewers() as $player){
$this->getInventory()->close($player);
}
foreach($this->getRealInventory()->getViewers() as $player){
$this->getRealInventory()->close($player);
}
parent::close();
}
}
public function saveNBT(){
$this->namedtag->Items = new Enum("Items", []);
$this->namedtag->Items->setTagType(NBT::TAG_Compound);

View File

@ -67,6 +67,15 @@ class Furnace extends Tile implements InventoryHolder, Container{
}
}
public function close(){
if($this->closed === false){
foreach($this->getInventory()->getViewers() as $player){
$this->getInventory()->close($player);
}
parent::close();
}
}
public function saveNBT(){
$this->namedtag->Items = new Enum("Inventory", []);
$this->namedtag->Items->setTagType(NBT::TAG_Compound);