Fixed #1530 Container tiles not getting imported right when they are empty

This commit is contained in:
Shoghi Cervantes 2014-06-23 22:40:14 +02:00
parent 88157d6e99
commit df68853c76
2 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,12 @@ class Chest extends Spawnable implements InventoryHolder, Container{
$nbt["id"] = Tile::CHEST;
parent::__construct($chunk, $nbt);
$this->inventory = new ChestInventory($this);
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof Enum)){
$this->namedtag->Items = new Enum("Inventory", []);
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
}
for($i = 0; $i < $this->getSize(); ++$i){
$this->inventory->setItem($i, $this->getItem($i));
}

View File

@ -45,6 +45,11 @@ class Furnace extends Tile implements InventoryHolder, Container{
$this->inventory->setItem($i, $this->getItem($i));
}
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof Enum)){
$this->namedtag->Items = new Enum("Inventory", []);
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
}
if(!isset($this->namedtag->BurnTime) or $this->namedtag["BurnTime"] < 0){
$this->namedtag->BurnTime = new Short("BurnTime", 0);
}